lib/rconf/configurators/ruby_configurator.rb in rconf-0.6.5 vs lib/rconf/configurators/ruby_configurator.rb in rconf-0.6.10
- old
+ new
@@ -21,13 +21,13 @@
register :ruby
description "Installs ruby interpreter and rubygems.\n" +
'Installs and uses rvm on supported (i.e. non-Windows) platforms'
- 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'
+ 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
# Switch to ruby version defined in settings
# Use rvm and install it if needed
@@ -52,11 +52,12 @@
run
return true
when /^Using /
report_success
check_rvmrc
- post_note "Configuration required switching the active ruby\nPlease 'cd' into the project directory again to activate it"
+ post_note "Configuration required switching the active ruby\nPlease run " + 'cd ..;cd -'.blue + ' to activate it and re-run rconf'
+ aborting(true)
else
report_fatal("Failed to use #{version}:\n#{out}")
end
end
if gemset
@@ -76,11 +77,10 @@
report_check("Switching to gemset #{gemset}")
Command.execute('rvm', version, 'gemset', 'use', gemset,
:abort_on_failure => "Failed to switch to gemset '#{gemset}'")
report_success
end
- Command.set_prefix("rvm #{version}@#{gemset} exec --")
true
end
alias :run_darwin :run_linux
# Switch to ruby version defined in settings
@@ -89,10 +89,19 @@
# === Return
# true:: Always return true
def run_windows
end
+ # Set command prefix when already configured
+ #
+ # === Return
+ # true:: Always return true
+ def post_process
+ Command.set_prefix("rvm #{version}@#{gemset} exec --")
+ true
+ end
+
protected
# Check whether the right version of RVM is installed and install it if not
#
# === Parameters
@@ -213,9 +222,10 @@
unless content.include?(rvm_bash_activation)
content = rvm_bash_activation + "\n" + content
FileUtils.mv(bashrc_path, bashrc_path + '.old')
File.open(bashrc_path, 'w') { |f| f.puts content }
post_note 'rvm was installed, please reload your shell to activate it and re-run rconf'
+ aborting(true)
end
else
report_error("Failed to update bashrc to activate rvm, no bashrc found")
end
end