Class: RightScraper::Scrapers::Cookbook
- Inherits:
-
Base
- Object
- RegisteredBase
- Base
- RightScraper::Scrapers::Cookbook
- Defined in:
- lib/right_scraper/scrapers/cookbook.rb
Overview
Chef cookbook scraper
Constant Summary collapse
- COOKBOOK_SENTINELS =
['metadata.json', 'metadata.rb']
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#default_builders ⇒ Object
List of default builders for this scaper.
-
#default_scanners ⇒ Object
List of default scanners for this scaper.
-
#find_next(dir) ⇒ Object
Find the next cookbook, starting in dir.
Methods inherited from Base
#close, #next_resource, registration_module, #scrape, scraper
Methods inherited from RegisteredBase
query_registered_type, register_class, register_self, registered_types, registration_module
Instance Method Details
#default_builders ⇒ Object
List of default builders for this scaper
Return
- Array<Builder>
-
Default builders
68 69 70 |
# File 'lib/right_scraper/scrapers/cookbook.rb', line 68 def default_builders [RightScraper::Builders::Filesystem] end |
#default_scanners ⇒ Object
List of default scanners for this scaper
Return
- Array<Scanner>
-
Default scanners
59 60 61 62 |
# File 'lib/right_scraper/scrapers/cookbook.rb', line 59 def default_scanners [RightScraper::Scanners::CookbookMetadata, RightScraper::Scanners::CookbookManifest] end |
#find_next(dir) ⇒ Object
Find the next cookbook, starting in dir.
Parameters
- dir(Dir)
-
directory to begin search in
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/right_scraper/scrapers/cookbook.rb', line 37 def find_next(dir) @logger.operation(:finding_next_cookbook, "in #{dir.path}") do if COOKBOOK_SENTINELS.any? { |f| File.exists?(File.join(dir.path, f)) } @logger.operation(:reading_cookbook, "from #{dir.path}") do cookbook = RightScraper::Resources::Cookbook.new( @repository, strip_repo_dir(dir.path), repo_dir) @builder.go(dir.path, cookbook) cookbook end else @stack << dir search_dirs end end end |