Class: Itamae::Recipe::RecipeFromDefinition

Inherits:
Itamae::Recipe show all
Defined in:
lib/itamae/recipe.rb

Constant Summary

Constants inherited from Itamae::Recipe

NotFoundError

Instance Attribute Summary collapse

Attributes inherited from Itamae::Recipe

#children, #delayed_notifications, #path, #runner

Instance Method Summary collapse

Methods inherited from Itamae::Recipe

#dir, find_recipe_in_gem, #initialize

Constructor Details

This class inherits a constructor from Itamae::Recipe

Instance Attribute Details

#definitionObject

Returns the value of attribute definition.



174
175
176
# File 'lib/itamae/recipe.rb', line 174

def definition
  @definition
end

Instance Method Details

#load(vars = {}) ⇒ Object



176
177
178
179
# File 'lib/itamae/recipe.rb', line 176

def load(vars = {})
  context = EvalContext.new(self, vars)
  context.instance_eval(&@definition.class.definition_block)
end

#runObject



181
182
183
184
185
186
187
188
189
190
191
# File 'lib/itamae/recipe.rb', line 181

def run
  if @definition.do_not_run_because_of_only_if?
    Itamae.logger.debug "#{@definition.resource_type}[#{@definition.resource_name}] Execution skipped because of only_if attribute"
    return
  elsif @definition.do_not_run_because_of_not_if?
    Itamae.logger.debug "#{@definition.resource_type}[#{@definition.resource_name}] Execution skipped because of not_if attribute"
    return
  end

  super
end