Class: Vito::Recipe

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

Overview

This is a parent class for recipes and shouldn’t be used directly.

Instance Method Summary collapse

Constructor Details

#initialize(options, connection) ⇒ Recipe

Returns a new instance of Recipe.



5
6
7
8
# File 'lib/vito/recipe.rb', line 5

def initialize(options, connection)
  @options = options
  @connection = connection
end

Instance Method Details

#depends_on_recipe(recipe, options = {}) ⇒ Object



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

def depends_on_recipe(recipe, options = {})
  Dsl::Installation.new(recipe, options, @connection).install
end

#install_os_dependenciesObject



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

def install_os_dependencies
  os.update_packages
  os.install_dependencies(os_dependencies) if self.respond_to?(:os_dependencies)
end

#osObject



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

def os
  @os ||= Vito::OperatingSystem.new(@connection).os
end

#program_version(version_command) ⇒ Object

Helper methods

should be extracted later



29
30
31
# File 'lib/vito/recipe.rb', line 29

def program_version(version_command)
  Vito::Utils::ProgramVersion.new(version_command, @connection)
end

#query(command) ⇒ Object



22
23
24
# File 'lib/vito/recipe.rb', line 22

def query(command)
  @connection.query(command)
end

#runObject



10
11
12
# File 'lib/vito/recipe.rb', line 10

def run
  raise "#{self.class.name} recipe needs to define a #run method"
end

#run_command(command) ⇒ Object



18
19
20
# File 'lib/vito/recipe.rb', line 18

def run_command(command)
  @connection.run(command)
end