lib/rconf/configurators/ruby_configurator.rb in rconf-0.7.15 vs lib/rconf/configurators/ruby_configurator.rb in rconf-0.8.0
- old
+ new
@@ -12,12 +12,15 @@
module RightConf
class RubyConfigurator
# RVM version used to install rubies
- RVM_VERSION = '1.2.9'
+ RVM_VERSION = '1.6.2'
+ # RVM releases URL
+ RVM_RELEASES_URL = 'https://rvm.beginrescueend.com/releases'
+
include Configurator
register :ruby
description "Installs ruby interpreter and rubygems.\n" +
@@ -126,23 +129,28 @@
out = Command.execute('rvm', '--version').output
if out =~ /rvm #{RVM_VERSION.gsub('.', '\\.')}/
report_success
else
report_failure
- report_check("Installing rvm #{version}")
- rvm_src = File.join(ENV['HOME'] || '/root', '.rvm/src')
- FileUtils.mkdir_p(rvm_src)
- Dir.chdir(rvm_src) do
- Command.execute('curl', '-O', '-f',
- "http://rvm.beginrescueend.com/releases/rvm-#{version}.tar.gz",
- :abort_on_failure => "Failed to download rvm #{version}")
- Command.execute('tar', 'zxf', "rvm-#{version}.tar.gz",
- :abort_on_failure => "Failed to extract rvm tgz from #{File.join(Dir.getwd, 'rvm-' + version + '.tar.gz')}")
+ if out =~ /rvm ([^\s]+)/
+ report_fatal "You have rvm #{Regexp.last_match[1]} installed which is not compatible with rconf.\n" +
+ "Please uninstall your version of rvm and re-run rconf which will install rvm #{RVM_VERSION}."
+ else
+ report_check("Installing rvm #{version}")
+ rvm_src = File.join(ENV['HOME'] || '/root', '.rvm/src')
+ FileUtils.mkdir_p(rvm_src)
+ Dir.chdir(rvm_src) do
+ Command.execute('curl', '-O', '-f',
+ "#{RVM_RELEASES_URL}/rvm-#{version}.tar.gz",
+ :abort_on_failure => "Failed to download rvm #{version}")
+ Command.execute('tar', 'zxf', "rvm-#{version}.tar.gz",
+ :abort_on_failure => "Failed to extract rvm tgz from #{File.join(Dir.getwd, 'rvm-' + version + '.tar.gz')}")
+ end
+ Dir.chdir(File.join(rvm_src, "rvm-#{version}")) do
+ Command.execute('./install', :abort_on_failure => "Failed to install rvm #{version}")
+ end
+ report_success
end
- Dir.chdir(File.join(rvm_src, "rvm-#{version}")) do
- Command.execute('./install', :abort_on_failure => "Failed to install rvm #{version}")
- end
- report_success
end
setup_bashrc
true
end