lib/rconf/configurators/ruby_configurator.rb in rconf-0.8.11 vs lib/rconf/configurators/ruby_configurator.rb in rconf-0.8.12
- old
+ new
@@ -28,11 +28,11 @@
settings :version => 'Ruby version using rvm notation (see "rvm list known")',
:rubygems => 'Rubygems version, e.g. "1.3.7"',
:gemset => 'Gemset to be used for platforms supporting rvm'
- validate_has_settings :version, :rubygems
+ validate_has_settings :version
# Let configurator run, it is idempotent
#
# === Return
# false:: Always return false
@@ -47,10 +47,11 @@
#
# === Return
# true:: Always return true
def run_linux
check_rvm(RVM_VERSION)
+ return true if aborting
Command.set_ruby(version, gemset)
report_check("Checking whether #{version} is the active ruby")
out = Command.execute('rvm', 'list').output
if out =~ /^=> #{version.gsub('.', '\\.')}/
report_success
@@ -91,19 +92,21 @@
report_check("Switching to gemset #{gemset}")
Command.execute('rvm', version, 'exec', 'rvm', 'gemset', 'use', gemset,
:abort_on_failure => "Failed to switch to gemset '#{gemset}'")
report_success
end
- report_check("Checking whether rubygems #{rubygems} is installed")
- res = Command.execute_in_ruby('gem', '--version')
- if res.success? && res.output =~ /^#{rubygems}$/
- report_success
- else
- report_failure
- report_check("Installing rubygems #{rubygems}")
- Command.execute_in_ruby('rubygems', rubygems, :abort_on_failure => 'Failed to install rubygems')
- report_success
+ if rubygems
+ report_check("Checking whether rubygems #{rubygems} is installed")
+ res = Command.execute_in_ruby('gem', '--version')
+ if res.success? && res.output =~ /^#{rubygems}$/
+ report_success
+ else
+ report_failure
+ report_check("Installing rubygems #{rubygems}")
+ Command.execute_in_ruby('rubygems', rubygems, :abort_on_failure => 'Failed to install rubygems')
+ report_success
+ end
end
true
end
alias :run_darwin :run_linux
@@ -157,10 +160,12 @@
: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
+ post_note "Configuration required installing RVM, please start a new shell to activate it and re-run rconf to finish configuration".green
+ aborting(true)
report_success
end
setup_bashrc
true
end
@@ -246,10 +251,10 @@
#
# === Return
# true:: Always return true
def setup_bashrc
if EnvironmentUpdater.update(rvm_bash_activation, ['PATH'])
- post_note 'rvm was installed, please reload your shell to activate it and re-run rconf'
+ post_note '.rvmrc was updated, please reload your shell to activate it and re-run rconf'
aborting(true)
end
end
# rvm bash activation code