lib/bin_install/ruby/rvm.rb in bin_install-0.0.25 vs lib/bin_install/ruby/rvm.rb in bin_install-0.0.26
- old
+ new
@@ -13,26 +13,34 @@
puts 'Installing RVM...'.white
BinInstall.system!(INSTALL)
install_ruby!
end
- def self.install_ruby(version = nil)
- version ||= Ruby.required_ruby_version
+ def self.install_ruby(version = Ruby.required_ruby_version)
+ puts "Installing Ruby #{version}...".white
if version
- system("rvm install #{version}")
- system("rvm use #{version}")
+ if Ruby.ruby_version_installed?(version)
+ puts "Ruby #{version} is already installed. Skipping Ruby #{version} install.".blue
+ else
+ system("rvm install #{version}")
+ system("rvm use #{version}")
+ end
else
puts 'Unknown Ruby version. Create .ruby-version file.'
end
end
- def self.install_ruby!(version = nil)
- version ||= Ruby.required_ruby_version
+ def self.install_ruby!(version = Ruby.required_ruby_version)
+ puts "Installing Ruby #{version}...".white
if version
- BinInstall.system!("rvm install #{version}")
- BinInstall.system!("rvm use #{version}")
+ if Ruby.ruby_version_installed?(version)
+ puts "Ruby #{version} is already installed. Skipping Ruby #{version} install.".blue
+ else
+ BinInstall.system!("rvm install #{version}")
+ BinInstall.system!("rvm use #{version}")
+ end
else
abort('Unknown Ruby version. Create .ruby-version file.'.red)
end
end