Module: Wildcloud::Runner::RubyTemplate

Included in:
Builder, Runner
Defined in:
lib/wildcloud/runner/template/ruby.rb

Instance Method Summary collapse

Instance Method Details

#ruby_use(config) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/wildcloud/runner/template/ruby.rb', line 20

def ruby_use(config)
  return unless config['version']
  version = config['version']

  logger.info('Ruby', "Changing to #{version}")
  change = run("rvm use #{version} 2>&1")

  if change =~ /To install do/
    logger.info('Ruby', "#{version} is not default Ruby, installing.")
    run("rvm install #{version} 2>&1")

    logger.info('Ruby', "Changing to #{version}")
    run("rvm use #{version} 2>&1")

    logger.info('Ruby', "Ensuring bundler #{version}")
    run("gem install bundler foreman 2>&1")
  end
end