Class: Berkshelf::API::CacheBuilder::Worker::Supermarket
- Defined in:
- lib/berkshelf/api/cache_builder/worker/supermarket.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#cookbooks ⇒ Array<RemoteCookbook>
The list of cookbooks this builder can find.
-
#initialize(options = {}) ⇒ Supermarket
constructor
A new instance of Supermarket.
-
#metadata(remote) ⇒ Ridley::Chef::Cookbook::Metadata?
Return the metadata of the given RemoteCookbook.
Methods inherited from Base
Methods included from Mixin::Services
Methods included from Logging
Constructor Details
#initialize(options = {}) ⇒ Supermarket
Returns a new instance of Supermarket.
9 10 11 12 |
# File 'lib/berkshelf/api/cache_builder/worker/supermarket.rb', line 9 def initialize( = {}) @connection = Berkshelf::API::SiteConnector::Supermarket.new() super end |
Instance Method Details
#cookbooks ⇒ Array<RemoteCookbook>
Returns The list of cookbooks this builder can find.
16 17 18 19 20 21 22 23 24 |
# File 'lib/berkshelf/api/cache_builder/worker/supermarket.rb', line 16 def cookbooks connection.universe.inject([]) do |list, (name, versions)| versions.each do |version, info| list << RemoteCookbook.new(name, version, self.class.worker_type, info["location_path"], priority, info) end list end end |
#metadata(remote) ⇒ Ridley::Chef::Cookbook::Metadata?
Return the metadata of the given RemoteCookbook. If the metadata could not be found or parsed nil is returned.
32 33 34 35 36 37 38 |
# File 'lib/berkshelf/api/cache_builder/worker/supermarket.rb', line 32 def (remote) Ridley::Chef::Cookbook::Metadata.from_hash( 'name' => remote.name, 'version' => remote.version, 'dependencies' => remote.info['dependencies'] || {}, ) end |