Class: Berkshelf::API::CacheBuilder::Worker::Opscode
- Defined in:
- lib/berkshelf/api/cache_builder/worker/opscode.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 = {}) ⇒ Opscode
constructor
A new instance of Opscode.
-
#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 = {}) ⇒ Opscode
Returns a new instance of Opscode.
11 12 13 14 |
# File 'lib/berkshelf/api/cache_builder/worker/opscode.rb', line 11 def initialize( = {}) @connection = Berkshelf::API::SiteConnector::Opscode.pool_link(size: 25, args: [ ]) super end |
Instance Method Details
#cookbooks ⇒ Array<RemoteCookbook>
Returns The list of cookbooks this builder can find.
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/berkshelf/api/cache_builder/worker/opscode.rb', line 18 def cookbooks [].tap do |cookbook_versions| connection.cookbooks.collect do |cookbook| [ cookbook, connection.future(:versions, cookbook) ] end.each do |cookbook, versions| versions.value.each do |version| cookbook_versions << RemoteCookbook.new(cookbook, version, self.class.worker_type, @connection.api_uri, priority) end end 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.
36 37 38 39 40 41 42 |
# File 'lib/berkshelf/api/cache_builder/worker/opscode.rb', line 36 def (remote) Dir.mktmpdir('metadata') do |destination| if connection.download(remote.name, remote.version, destination) (destination, remote.name) end end end |