Class: Berkshelf::ChefRepoUniverse
- Inherits:
-
Object
- Object
- Berkshelf::ChefRepoUniverse
- Defined in:
- lib/berkshelf/chef_repo_universe.rb
Overview
Shim to look like a Berkshelf::APIClient but for a chef repo folder.
Instance Method Summary collapse
-
#initialize(uri, **options) ⇒ ChefRepoUniverse
constructor
A new instance of ChefRepoUniverse.
- #universe ⇒ Object
Constructor Details
#initialize(uri, **options) ⇒ ChefRepoUniverse
Returns a new instance of ChefRepoUniverse.
9 10 11 12 13 |
# File 'lib/berkshelf/chef_repo_universe.rb', line 9 def initialize(uri, **) @uri = uri @path = [:path] @options = end |
Instance Method Details
#universe ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/berkshelf/chef_repo_universe.rb', line 15 def universe Dir.entries(cookbooks_path).sort.each_with_object([]) do |entry, cookbooks| next if entry[0] == "." # Skip hidden folders. entry_path = "#{cookbooks_path}/#{entry}" next unless File.directory?(entry_path) # Skip non-dirs. cookbook = begin Berkshelf::CachedCookbook.from_path(entry_path) rescue IOError next # It wasn't a cookbook. end cookbooks << Berkshelf::APIClient::RemoteCookbook.new( cookbook.cookbook_name, cookbook.version, location_type: "file_store", location_path: entry_path, dependencies: cookbook..dependencies ) end end |