Class: ChefDK::Policyfile::IncludedPoliciesCookbookSource
- Inherits:
-
Object
- Object
- ChefDK::Policyfile::IncludedPoliciesCookbookSource
- Defined in:
- lib/chef-dk/policyfile/included_policies_cookbook_source.rb
Defined Under Namespace
Classes: ConflictingCookbookDependencies, ConflictingCookbookSources, ConflictingCookbookVersions
Instance Attribute Summary collapse
-
#included_policy_location_specs ⇒ Object
readonly
A list of included policies.
-
#ui ⇒ Object
UI object for output.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #check_for_conflicts! ⇒ Object
- #default_source_args ⇒ Object
- #desc ⇒ Object
-
#initialize(included_policy_location_specs) {|_self| ... } ⇒ IncludedPoliciesCookbookSource
constructor
Constructor.
- #null? ⇒ Boolean
- #preferred_cookbooks ⇒ Object
-
#preferred_source_for?(cookbook_name) ⇒ Boolean
All are preferred here.
-
#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(included_policy_location_specs) {|_self| ... } ⇒ IncludedPoliciesCookbookSource
Constructor
46 47 48 49 50 51 |
# File 'lib/chef-dk/policyfile/included_policies_cookbook_source.rb', line 46 def initialize(included_policy_location_specs) @included_policy_location_specs = included_policy_location_specs @ui = UI.new @preferred_cookbooks = [] yield self if block_given? end |
Instance Attribute Details
#included_policy_location_specs ⇒ Object (readonly)
A list of included policies
40 41 42 |
# File 'lib/chef-dk/policyfile/included_policies_cookbook_source.rb', line 40 def included_policy_location_specs @included_policy_location_specs end |
#ui ⇒ Object
UI object for output
42 43 44 |
# File 'lib/chef-dk/policyfile/included_policies_cookbook_source.rb', line 42 def ui @ui end |
Instance Method Details
#==(other) ⇒ Object
71 72 73 |
# File 'lib/chef-dk/policyfile/included_policies_cookbook_source.rb', line 71 def ==(other) other.is_a?(self.class) && other.included_policy_location_specs == included_policy_location_specs end |
#check_for_conflicts! ⇒ Object
57 58 59 60 |
# File 'lib/chef-dk/policyfile/included_policies_cookbook_source.rb', line 57 def check_for_conflicts! universe_graph end |
#default_source_args ⇒ Object
53 54 55 |
# File 'lib/chef-dk/policyfile/included_policies_cookbook_source.rb', line 53 def default_source_args [:included_policies, []] end |
#desc ⇒ Object
94 95 96 |
# File 'lib/chef-dk/policyfile/included_policies_cookbook_source.rb', line 94 def desc "included_policies()" end |
#null? ⇒ Boolean
90 91 92 |
# File 'lib/chef-dk/policyfile/included_policies_cookbook_source.rb', line 90 def null? false end |
#preferred_cookbooks ⇒ Object
67 68 69 |
# File 'lib/chef-dk/policyfile/included_policies_cookbook_source.rb', line 67 def preferred_cookbooks universe_graph.keys end |
#preferred_source_for?(cookbook_name) ⇒ Boolean
All are preferred here
63 64 65 |
# File 'lib/chef-dk/policyfile/included_policies_cookbook_source.rb', line 63 def preferred_source_for?(cookbook_name) universe_graph.include?(cookbook_name) end |
#source_options_for(cookbook_name, cookbook_version) ⇒ Hash
Returns the metadata (path and version) for an individual cookbook
86 87 88 |
# File 'lib/chef-dk/policyfile/included_policies_cookbook_source.rb', line 86 def (cookbook_name, cookbook_version) [cookbook_name][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.
79 80 81 |
# File 'lib/chef-dk/policyfile/included_policies_cookbook_source.rb', line 79 def universe_graph @universe_graph ||= build_universe end |