Class: RightConf::RubyConfigurator
- Inherits:
-
Object
- Object
- RightConf::RubyConfigurator
- Includes:
- Configurator
- Defined in:
- lib/rconf/configurators/ruby_configurator.rb
Constant Summary collapse
- RVM_VERSION =
RVM version used to install rubies
'1.2.9'
Instance Method Summary collapse
-
#post_process ⇒ Object
Set command prefix when already configured Re-create .rvmrc if needed.
-
#run_linux ⇒ Object
(also: #run_darwin)
Switch to ruby version defined in settings Use rvm and install it if needed.
-
#run_windows ⇒ Object
Switch to ruby version defined in settings TBD.
Methods included from Configurator
#[], included, #run, #signature, #validate
Methods included from ProgressReporter
included, report_to_file, report_to_stdout
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class RightConf::Configurator
Instance Method Details
#post_process ⇒ Object
Set command prefix when already configured Re-create .rvmrc if needed
Return
- true
-
Always return true
109 110 111 112 113 |
# File 'lib/rconf/configurators/ruby_configurator.rb', line 109 def post_process Command.set_ruby(version, gemset) check_rvmrc true end |
#run_linux ⇒ Object Also known as: run_darwin
Switch to ruby version defined in settings Use rvm and install it if needed
Return
- true
-
Always return true
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/rconf/configurators/ruby_configurator.rb', line 37 def run_linux check_rvm(RVM_VERSION) 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 else report_failure report_check("Switching to #{version}") out = Command.execute('rvm', 'use', version).output case out when /is not installed\./ report_failure report_fatal "Failed to install #{ruby}" if @tried install_ruby(version) @tried = true Command.execute_in_ruby('gem', 'install', 'rconf') unless gemset run return true when /^Using / report_success check_rvmrc else report_fatal("Failed to use #{version}:\n#{out}") end end if gemset report_check("Checking whether gemset #{gemset} exists") res = Command.execute('rvm', version, 'exec', 'rvm', 'gemset', 'list') if res.output =~ /^(\s+|=> )#{gemset}$/ report_success else report_failure report_check("Creating gemset #{gemset} for #{version}") Command.execute('rvm', version, 'exec', 'rvm', 'gemset', 'create', gemset, :abort_on_failure => "Failed to create gemset '#{gemset}'") Command.execute_in_ruby('gem', 'install', 'rconf') report_success end 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.chomp == 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 true end |
#run_windows ⇒ Object
Switch to ruby version defined in settings TBD
Return
- true
-
Always return true
101 102 |
# File 'lib/rconf/configurators/ruby_configurator.rb', line 101 def run_windows end |