Class: Rbenv

Inherits:
Object
  • Object
show all
Defined in:
lib/myosx/rbenv.rb

Instance Method Summary collapse

Instance Method Details

#configObject



11
12
13
# File 'lib/myosx/rbenv.rb', line 11

def config
  Konfig.new.global['rbenv']
end

#execObject



34
35
36
37
# File 'lib/myosx/rbenv.rb', line 34

def exec
  install_rbenv
  install_rubies
end

#install_rbenvObject



15
16
17
18
19
20
21
22
23
# File 'lib/myosx/rbenv.rb', line 15

def install_rbenv
  packages = ['rbenv', 'rbenv-aliases', 'rbenv-bundler']
  packages.each do |pkg|
    unless system("brew list #{pkg} >/dev/null 2>&1")
      puts "Installing #{pkg}"
      system("brew install #{pkg}")
    end
  end
end

#install_rubiesObject



25
26
27
28
29
30
31
32
# File 'lib/myosx/rbenv.rb', line 25

def install_rubies
  versions = config['versions']
  puts "Ensuring Ruby version(s) installed:"
  versions.each do |version|
    puts " - #{version}"
    system("rbenv install #{version} --skip-existing")
  end
end