Created
August 25, 2009 02:31
-
-
Save ukstudio/174406 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/usr/bin/env ruby | |
| # coding: utf-8 | |
| require 'fileutils' | |
| PATH = "/Users/uk/local/bin" | |
| RUBY_VER = ["1.9.2", "1.8.7"] | |
| CMD = ["ruby", "irb", "gem"] | |
| version = ARGV.first | |
| exit unless RUBY_VER.include? version | |
| def remove_symbolic_link(version) | |
| FileUtils.rm(CMD.map{|c| PATH + "/#{c}"}) | |
| end | |
| def create_symbolic_link(version) | |
| CMD.each do |c| | |
| original = PATH + "/#{c}-#{version}" | |
| link = PATH + "/#{c}" | |
| FileUtils.symlink(original, link) | |
| end | |
| end | |
| remove_symbolic_link(version) | |
| create_symbolic_link(version) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment