Class: RightConf::RubyConfigurator

Inherits:
Object
  • Object
show all
Includes:
Configurator
Defined in:
lib/rconf/configurators/ruby_configurator.rb

Constant Summary collapse

PATH_ADVICE =

Message to display to the user when rbenv isn’t in the path.

"You should add rbenv to your path and 'eval \"$(rbenv init -)\"' to your .bash_profile / .bashrc etc. " +
"so rbenv is properly initialized in new shells.\n\n" +
"If you are a bash user (e.g. Mac OS X), you can add the following to ~/.bash_profile:\n\n" +
"  echo 'export PATH=\"$HOME/.rbenv/bin:$PATH\"' >> ~/.bash_profile\n" +
"  echo 'eval \"$(rbenv init -)\"' >> ~/.bash_profile\n\n"

Instance Method Summary collapse

Methods included from Configurator

#[], #check, included, #post_process, #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

#check_linuxObject Also known as: check_darwin, check_windows

Let configurator run, it is idempotent

Return

false

Always return false



58
59
60
# File 'lib/rconf/configurators/ruby_configurator.rb', line 58

def check_linux
  false
end

#run_linuxObject Also known as: run_darwin

Switch to ruby version defined in settings Use rbenv and install it if needed

Return

true

Always return true



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/rconf/configurators/ruby_configurator.rb', line 69

def run_linux
  if Command.execute('rvm').success?
    report_fatal "rconf detected an installation of RVM, rconf now uses rbenv to configure ruby versions.\n" +
      "Unfortunately rbenv and RVM cannot be installed together on the same machine (see https://github.com/sstephenson/rbenv/).\n" +
      "Please uninstall RVM and try again ('rvm implode' will delete RVM and all installed rubies and gems).\n" +
      "Once RVM is uninstalled please start a new shell (you may also need to remove references to RVM from your ~/.bash_profile)"
    return true
  end
  check_rbenv
  return true if aborting
  check_ruby
  Command.set_ruby(ruby_with_rubygems_version)
  check_rubygems
 true
end

#run_windowsObject

Switch to ruby version defined in settings TBD

Return

true

Always return true



91
92
# File 'lib/rconf/configurators/ruby_configurator.rb', line 91

def run_windows
end