Class: Automatic::Recipe

Inherits:
Object
  • Object
show all
Defined in:
lib/automatic/recipe.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path = "") ⇒ Recipe

Returns a new instance of Recipe.



17
18
19
# File 'lib/automatic/recipe.rb', line 17

def initialize(path = "")
  load_recipe(path)
end

Instance Attribute Details

#procedureObject (readonly)

Returns the value of attribute procedure.



15
16
17
# File 'lib/automatic/recipe.rb', line 15

def procedure
  @procedure
end

Instance Method Details

#each_pluginObject



31
32
33
34
35
# File 'lib/automatic/recipe.rb', line 31

def each_plugin
  @procedure.plugins.each {|plugin|
    yield plugin
  }
end

#load_recipe(path) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/automatic/recipe.rb', line 21

def load_recipe(path)
  dir = File.join((File.expand_path('~/.automatic/config/')), path)
  path = dir if File.exist?(dir)
  @procedure = Hashie::Mash.new(YAML.load(File.read(path)))
  log_level = @procedure.global && @procedure.global.log && @procedure.global.log.level
  Automatic::Log.level(log_level)
  Automatic::Log.puts("info", "Loading Recipe: #{path}")
  @procedure
end