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.6'
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
96 97 98 99 100 |
# File 'lib/rconf/configurators/ruby_configurator.rb', line 96 def post_process Command.set_prefix("rvm #{version}@#{gemset} exec --") 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 |
# File 'lib/rconf/configurators/ruby_configurator.rb', line 37 def run_linux check_rvm(RVM_VERSION) 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}: #{@out}" if @out @out = install_ruby(version) run return true when /^Using / report_success check_rvmrc aborting(true) 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, 'gemset', 'list') if res.output =~ /^#{gemset}$/ report_success else report_failure report_check("Creating gemset #{gemset} for #{version}") Command.execute('rvm', version, 'gemset', 'create', gemset, :abort_on_failure => "Failed to create gemset '#{gemset}'") report_success end 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 true end |
#run_windows ⇒ Object
Switch to ruby version defined in settings TBD
Return
- true
-
Always return true
88 89 |
# File 'lib/rconf/configurators/ruby_configurator.rb', line 88 def run_windows end |