Class: RightScraper::Scrapers::Cookbook

Inherits:
Base
  • Object
show all
Defined in:
lib/right_scraper/scrapers/cookbook.rb

Overview

Chef cookbook scraper

Instance Attribute Summary

Attributes inherited from Base

#resources

Instance Method Summary collapse

Methods inherited from Base

#close, #next_resource, #scrape, scraper

Instance Method Details

#default_buildersObject

List of default builders for this scaper

Return

Array<Builder>

Default builders



64
65
66
# File 'lib/right_scraper/scrapers/cookbook.rb', line 64

def default_builders
  [RightScraper::Builders::Filesystem]
end

#default_scannersObject

List of default scanners for this scaper

Return

Array<Scanner>

Default scanners



55
56
57
58
# File 'lib/right_scraper/scrapers/cookbook.rb', line 55

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



36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/right_scraper/scrapers/cookbook.rb', line 36

def find_next(dir)
  @logger.operation(:finding_next_cookbook, "in #{dir.path}") do
    if File.exists?(File.join(dir.path, 'metadata.json'))
      @logger.operation(:reading_cookbook, "from #{dir.path}") do
        cookbook = RightScraper::Resources::Cookbook.new(@repository, strip_repo_dir(dir.path))
        @builder.go(dir.path, cookbook)
        cookbook
      end
    else
      @stack << dir
      search_dirs
    end
  end
end