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
- #desc ⇒ Object
-
#initialize(uri = nil) ⇒ CommunityCookbookSource
constructor
A new instance of CommunityCookbookSource.
- #null? ⇒ Boolean
- #source_options_for(cookbook_name, cookbook_version) ⇒ Object
- #universe_graph ⇒ Object
Constructor Details
#initialize(uri = nil) ⇒ CommunityCookbookSource
Returns a new instance of CommunityCookbookSource.
30 31 32 33 |
# File 'lib/chef-dk/policyfile/community_cookbook_source.rb', line 30 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.
28 29 30 |
# File 'lib/chef-dk/policyfile/community_cookbook_source.rb', line 28 def uri @uri end |
Instance Method Details
#==(other) ⇒ Object
35 36 37 |
# File 'lib/chef-dk/policyfile/community_cookbook_source.rb', line 35 def ==(other) other.kind_of?(self.class) && other.uri == uri end |
#desc ⇒ Object
60 61 62 |
# File 'lib/chef-dk/policyfile/community_cookbook_source.rb', line 60 def desc "supermarket(#{uri})" end |
#null? ⇒ Boolean
56 57 58 |
# File 'lib/chef-dk/policyfile/community_cookbook_source.rb', line 56 def null? false end |
#source_options_for(cookbook_name, cookbook_version) ⇒ Object
51 52 53 54 |
# File 'lib/chef-dk/policyfile/community_cookbook_source.rb', line 51 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
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/chef-dk/policyfile/community_cookbook_source.rb', line 39 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 |