Module: BinInstall::Ruby::Rvm
- Defined in:
- lib/bin_install/ruby/rvm.rb
Constant Summary collapse
- INSTALL =
'\curl -sSL https://get.rvm.io | bash'.freeze
Class Method Summary collapse
- .abort_install! ⇒ Object
- .install ⇒ Object
- .install! ⇒ Object
- .install_ruby(version = Ruby.required_ruby_version) ⇒ Object
- .install_ruby!(version = Ruby.required_ruby_version) ⇒ Object
- .installed? ⇒ Boolean
- .require_loaded! ⇒ Object
Class Method Details
.abort_install! ⇒ Object
55 56 57 58 59 60 61 62 63 |
# File 'lib/bin_install/ruby/rvm.rb', line 55 def self.abort_install! puts 'Warning RVM is not loaded.'.yellow puts 'Try closing this window and restarting your shell session.'.yellow puts "\n" puts 'Rerun the installer with:' puts '$ bin/install'.cyan puts "\n" abort('Aborting install.'.red) end |
.install ⇒ Object
6 7 8 9 10 11 |
# File 'lib/bin_install/ruby/rvm.rb', line 6 def self.install puts 'Installing RVM...'.white system(INSTALL) require_loaded! install_ruby end |
.install! ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/bin_install/ruby/rvm.rb', line 13 def self.install! puts 'Installing RVM...'.white BinInstall.system!(INSTALL) BinInstall.system!('source ~/.rvm/scripts/rvm') require_loaded! install_ruby! end |
.install_ruby(version = Ruby.required_ruby_version) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/bin_install/ruby/rvm.rb', line 21 def self.install_ruby(version = Ruby.required_ruby_version) puts "Installing Ruby #{version}...".white if version if Ruby.ruby_version_installed?(version) puts "Ruby #{version} is already installed. Skipping Ruby #{version} install.".blue else system("rvm install #{version}") abort_install! end else puts 'Unknown Ruby version. Create .ruby-version file.' end end |
.install_ruby!(version = Ruby.required_ruby_version) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/bin_install/ruby/rvm.rb', line 36 def self.install_ruby!(version = Ruby.required_ruby_version) puts "Installing Ruby #{version}...".white if version if Ruby.ruby_version_installed?(version) puts "Ruby #{version} is already installed. Skipping Ruby #{version} install.".blue else BinInstall.system!("rvm install #{version}") abort_install! end else abort('Unknown Ruby version. Create .ruby-version file.'.red) end end |
.installed? ⇒ Boolean
65 66 67 |
# File 'lib/bin_install/ruby/rvm.rb', line 65 def self.installed? Shell.executable_exists?('rvm') end |
.require_loaded! ⇒ Object
51 52 53 |
# File 'lib/bin_install/ruby/rvm.rb', line 51 def self.require_loaded! abort_install! unless installed? end |