Skip to content

Instantly share code, notes, and snippets.

@kei-s
Created January 26, 2011 06:55
Show Gist options
  • Save kei-s/796338 to your computer and use it in GitHub Desktop.
Save kei-s/796338 to your computer and use it in GitHub Desktop.
#coding:utf-8
# Thanks to http://d.hatena.ne.jp/cuzic/20100101
system191 = ["/usr/", "1.9.1", 100]
commands = %w(ruby irb gem rake rdoc testrb erb)
[system191].each do |dir, suffix, priority|
args = commands.map do |command|
link = "/usr/bin/#{command}"
fullpathcmd = "#{File.join(dir, "bin", command)}#{suffix}"
if command == "ruby" then
"--install #{link} #{command} #{fullpathcmd} #{priority}"
else
"--slave #{link} ruby-#{command} #{fullpathcmd}"
end
end.join(" ")
altcmd = "sudo update-alternatives #{args}"
system altcmd
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment