Skip to content

Instantly share code, notes, and snippets.

@lukemelia
Created October 8, 2009 05:26
Show Gist options
  • Save lukemelia/204776 to your computer and use it in GitHub Desktop.
Save lukemelia/204776 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
source_dir = nil
if ARGV[0] == 'ree'
source_dir = lambda { |binary| "/opt/ruby-enterprise-1.8.6-20090610/bin/#{binary}" }
elsif ARGV[0] == 'mri'
source_dir = lambda { |binary| "/usr/bin/#{binary}18" }
else
raise ArgumentError.new("acceptable args are 'mri' and 'ree'")
end
%w[erb gem irb rackup rails rake rdoc ri ruby testrb].each do |binary|
cmd = "sudo rm /usr/bin/#{binary}"
puts cmd
puts `#{cmd}`
cmd = "sudo ln -s #{source_dir.call(binary)} /usr/bin/#{binary}"
puts cmd
puts `#{cmd}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment