Class: ChefDK::Policyfile::ChefRepoCookbookSource
- Inherits:
-
Object
- Object
- ChefDK::Policyfile::ChefRepoCookbookSource
- Defined in:
- lib/chef-dk/policyfile/chef_repo_cookbook_source.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
path to a chef-repo or the cookbook path under it.
-
#ui ⇒ Object
UI object for output.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #desc ⇒ Object
-
#initialize(path) ⇒ ChefRepoCookbookSource
constructor
Constructor.
- #null? ⇒ Boolean
-
#source_options_for(cookbook_name, cookbook_version) ⇒ Hash
Returns the metadata (path and version) for an individual cookbook.
-
#universe_graph ⇒ Hash
Calls the slurp_metadata! helper once to calculate the @universe_graph and @cookbook_version_paths metadata.
Constructor Details
#initialize(path) ⇒ ChefRepoCookbookSource
Constructor
35 36 37 38 |
# File 'lib/chef-dk/policyfile/chef_repo_cookbook_source.rb', line 35 def initialize(path) self.path = path @ui = UI.new end |
Instance Attribute Details
#path ⇒ Object
path to a chef-repo or the cookbook path under it
28 29 30 |
# File 'lib/chef-dk/policyfile/chef_repo_cookbook_source.rb', line 28 def path @path end |
#ui ⇒ Object
UI object for output
30 31 32 |
# File 'lib/chef-dk/policyfile/chef_repo_cookbook_source.rb', line 30 def ui @ui end |
Instance Method Details
#==(other) ⇒ Object
40 41 42 |
# File 'lib/chef-dk/policyfile/chef_repo_cookbook_source.rb', line 40 def ==(other) other.kind_of?(self.class) && other.path == path end |
#desc ⇒ Object
64 65 66 |
# File 'lib/chef-dk/policyfile/chef_repo_cookbook_source.rb', line 64 def desc "chef_repo(#{path})" end |
#null? ⇒ Boolean
60 61 62 |
# File 'lib/chef-dk/policyfile/chef_repo_cookbook_source.rb', line 60 def null? false end |
#source_options_for(cookbook_name, cookbook_version) ⇒ Hash
Returns the metadata (path and version) for an individual cookbook
56 57 58 |
# File 'lib/chef-dk/policyfile/chef_repo_cookbook_source.rb', line 56 def (cookbook_name, cookbook_version) { path: cookbook_version_paths[cookbook_name][cookbook_version], version: cookbook_version } end |
#universe_graph ⇒ Hash
Calls the slurp_metadata! helper once to calculate the @universe_graph and @cookbook_version_paths metadata. Returns the @universe_graph.
48 49 50 51 |
# File 'lib/chef-dk/policyfile/chef_repo_cookbook_source.rb', line 48 def universe_graph if @universe_graph.nil? @universe_graph end |