Class: PoolParty::Resources::ChefRecipe

Inherits:
PoolParty::Resource show all
Defined in:
lib/dependency_resolvers/chef/resources/chef_recipe.rb

Instance Attribute Summary

Attributes inherited from PoolParty::Resource

#exists, #graph_index, #meta_not_if, #meta_notifies, #meta_only_if, #meta_subscribes

Attributes inherited from Base

#base_name, #init_opts

Instance Method Summary collapse

Methods inherited from PoolParty::Resource

#after_compile, #after_loaded_requires_parent, #before_compile, #case_of, #cloud, #compile, define_resource, define_resource_methods, defined, defined_resources, #does_not_exist!, #exists!, has_method_name, #has_method_name, inherited, #initialize, is_base_resource_class?, method_defined!, method_defined?, #not_if, #notifies, #only_if, #pool, #print_variable, #requires, #subscribes

Methods inherited from Base

#add_ordered_resources_to_result, #after_loaded, #all_resources, #before_load, #clouds_dot_rb_dir, clouds_dot_rb_dir, clouds_dot_rb_file, #clouds_dot_rb_file, #compile_opts, #create_graph, #dependencies, #get_resource, #has_searchable_paths, #initialize, #method_missing, #ordered_resources, #output_resources_graph, #resources, #resources_graph, #resources_with_dependencies, #resources_without_dependencies, #run_in_context, #run_with_callbacks, #to_s, #validations

Methods included from Delayed

included

Methods included from Callbacks

included

Methods included from SearchablePaths

included

Constructor Details

This class inherits a constructor from PoolParty::Resource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PoolParty::Base

Instance Method Details

#basenameObject



40
41
42
# File 'lib/dependency_resolvers/chef/resources/chef_recipe.rb', line 40

def basename
  File.basename(name)
end

#full_pathObject



36
37
38
# File 'lib/dependency_resolvers/chef/resources/chef_recipe.rb', line 36

def full_path
  File.expand_path(path)
end

#pathObject



32
33
34
# File 'lib/dependency_resolvers/chef/resources/chef_recipe.rb', line 32

def path
  @path ||= file || name
end


44
45
46
# File 'lib/dependency_resolvers/chef/resources/chef_recipe.rb', line 44

def print_to_chef
  "recipe \"#{basename}\""
end

#valid?Boolean

Returns:

  • (Boolean)


27
28
29
30
# File 'lib/dependency_resolvers/chef/resources/chef_recipe.rb', line 27

def valid?
  f = (file || name)
  raise PoolPartyError.create("ChefAttributesFileError", "You must specify a file that exists for a chef_attributes_file: #{f}") unless File.directory?(full_path)
end