Created
January 26, 2011 06:55
-
-
Save kei-s/796338 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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