Class: Serverkit::Recipe

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_recipe) ⇒ Recipe

Returns a new instance of Recipe.

Parameters:

  • raw_recipe (Hash)


20
21
22
# File 'lib/serverkit/recipe.rb', line 20

def initialize(raw_recipe)
  @raw_recipe = raw_recipe
end

Class Method Details

.load_from_path(path) ⇒ Object

Parameters:

  • path (String)


13
14
15
16
# File 'lib/serverkit/recipe.rb', line 13

def load_from_path(path)
  raw_recipe = YAML.load_file(path)
  new(raw_recipe)
end

Instance Method Details

#hosts ⇒ Array<String>

Returns:

  • (Array<String>)


33
34
35
# File 'lib/serverkit/recipe.rb', line 33

def hosts
  @raw_recipe["hosts"]
end

#resources ⇒ Array<Serverkit::Resources::Base>

TODO:

Delegate to resource builder

Returns:



26
27
28
29
30
# File 'lib/serverkit/recipe.rb', line 26

def resources
  @resources ||= resource_properties.map do |properties|
    Resources.const_get(properties["type"].camelize, false).new(properties)
  end
end

#ssh? ⇒ true, false

Returns Flag to use SSH (default: true).

Returns:

  • (true, false) —

    Flag to use SSH (default: true)



38
39
40
# File 'lib/serverkit/recipe.rb', line 38

def ssh?
  @raw_recipe["ssh"] != false
end