Class: Vito::Recipes::Ruby::Install

Inherits:
Vito::Recipe show all
Defined in:
lib/vito/recipes/ruby/install.rb

Instance Method Summary collapse

Methods inherited from Vito::Recipe

#depends_on_recipe, #initialize, #install_os_dependencies, #method_missing, #os, #program_version, #query, #remove, #run_command, #update, #with, #with?

Constructor Details

This class inherits a constructor from Vito::Recipe

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Vito::Recipe

Instance Method Details

#installObject



5
6
7
8
9
10
11
12
13
14
# File 'lib/vito/recipes/ruby/install.rb', line 5

def install
  if ruby_exists?
    Vito::Log.write "Ruby version #{version} is already installed."
  else
    Vito::Log.write "Installing Ruby"
    install_os_dependencies(os_dependencies)
    depends_on_recipe(:rbenv)
    install_ruby
  end
end

#install_rubyObject



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/vito/recipes/ruby/install.rb', line 16

def install_ruby
  version_to_install = version
  if version_to_install.nil?
    version_to_install = "2.0.0-p247"
    Vito::Log.write "No Ruby version specified, installing #{version_to_install}."
  end
  string = []
  string << "rbenv install #{version_to_install}"
  string << "rbenv global #{version_to_install}"
  string << "rbenv rehash"
  string << "gem install bundler"
  run_command string.join(" && ")
end