Skip to content

Instantly share code, notes, and snippets.

@m0wfo
Created August 17, 2011 23:57
Show Gist options
  • Save m0wfo/1152960 to your computer and use it in GitHub Desktop.
Save m0wfo/1152960 to your computer and use it in GitHub Desktop.
My RVM alternative
#!/Users/chris/.ruby/current/bin/ruby
RUBY_HOME = ENV['RUBY_HOME']
RUBIES = {:jruby => 'jruby-1.6.0', :rubinius => 'rubinius/1.2', :mri => 'mri19'}
GEM_EXECUTABLES = {:rubinius => 'gems/bin', :mri => ''}
if ARGV.empty?
p 'Available interpreters:'
RUBIES.each { |key,value| p key }
exit
end
ruby = ARGV.first
update_symlinks = lambda { |ruby|
ruby_path = RUBY_HOME + '/' + RUBIES[ruby]
current_bin_path = RUBY_HOME + '/current/bin'
executables = Dir.glob("#{ruby_path}/bin/*")
system("rm -rf #{current_bin_path}/*")
executables.each do |x|
system("ln -s #{x} #{current_bin_path}/")
end
gem_bins = "#{ruby_path}/#{GEM_EXECUTABLES[ruby]}"
gem_bin_path = RUBY_HOME + '/current/gem_bin'
system("rm -rf #{gem_bin_path}")
system("ln -s #{gem_bins} #{gem_bin_path}")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment