Skip to content

Instantly share code, notes, and snippets.

@ukstudio
Created August 25, 2009 02:31
Show Gist options
  • Select an option

  • Save ukstudio/174406 to your computer and use it in GitHub Desktop.

Select an option

Save ukstudio/174406 to your computer and use it in GitHub Desktop.
#!/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