Class: ChefDK::Policyfile::CommunityCookbookSource
- Inherits:
-
Object
- Object
- ChefDK::Policyfile::CommunityCookbookSource
- Defined in:
- lib/chef-dk/policyfile/community_cookbook_source.rb
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(uri = nil) ⇒ CommunityCookbookSource
constructor
A new instance of CommunityCookbookSource.
- #source_options_for(cookbook_name, cookbook_version) ⇒ Object
- #universe_graph ⇒ Object
Constructor Details
#initialize(uri = nil) ⇒ CommunityCookbookSource
Returns a new instance of CommunityCookbookSource.
33 34 35 36 |
# File 'lib/chef-dk/policyfile/community_cookbook_source.rb', line 33 def initialize(uri = nil) @uri = uri || "https://supermarket.chef.io" @http_connections = {} end |
Instance Attribute Details
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
31 32 33 |
# File 'lib/chef-dk/policyfile/community_cookbook_source.rb', line 31 def uri @uri end |
Instance Method Details
#==(other) ⇒ Object
38 39 40 |
# File 'lib/chef-dk/policyfile/community_cookbook_source.rb', line 38 def ==(other) other.kind_of?(self.class) && other.uri == uri end |
#source_options_for(cookbook_name, cookbook_version) ⇒ Object
54 55 56 57 |
# File 'lib/chef-dk/policyfile/community_cookbook_source.rb', line 54 def (cookbook_name, cookbook_version) base_uri = full_community_graph[cookbook_name][cookbook_version]["download_url"] { artifactserver: base_uri, version: cookbook_version } end |
#universe_graph ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/chef-dk/policyfile/community_cookbook_source.rb', line 42 def universe_graph @universe_graph ||= begin full_community_graph.inject({}) do |normalized_graph, (cookbook_name, )| normalized_graph[cookbook_name] = .inject({}) do |deps_by_version, (version, )| deps_by_version[version] = ["dependencies"] deps_by_version end normalized_graph end end end |