/usr/lib/ruby/vendor_ruby/berkshelf/api/cache_builder/worker/supermarket.rb is in berkshelf-api 2.2.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | module Berkshelf::API
class CacheBuilder
module Worker
class Supermarket < Worker::Base
worker_type 'supermarket'
# @param [Hash] options
# see {API::SiteConnector::Supermarket.new} for options
def initialize(options = {})
@connection = Berkshelf::API::SiteConnector::Supermarket.new(options)
super
end
# @return [Array<RemoteCookbook>]
# The list of cookbooks this builder can find
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
# Return the metadata of the given RemoteCookbook. If the metadata could not be found or parsed
# nil is returned.
#
# @param [RemoteCookbook] remote
#
# @return [Ridley::Chef::Cookbook::Metadata, nil]
def metadata(remote)
Ridley::Chef::Cookbook::Metadata.from_hash(
'name' => remote.name,
'version' => remote.version,
'dependencies' => remote.info['dependencies'] || {},
)
end
private
attr_accessor :connection
end
end
end
end
|