Skip to content

Instantly share code, notes, and snippets.

@rochefort
Created September 17, 2011 15:21
Show Gist options
  • Select an option

  • Save rochefort/1224037 to your computer and use it in GitHub Desktop.

Select an option

Save rochefort/1224037 to your computer and use it in GitHub Desktop.
creat gem install script from gem list
re = /(.*)\s\((.*)\)/
list=`gem list`
# install
list.each_line{|line| _,gem,versions=line.match(re).to_a; versions.split(', ').each{|ver| puts "gem install #{gem} -v=#{ver}"}}
# uninstall
list.each_line{|line| _,gem,_=line.match(re).to_a;puts "gem uninstall -a -I -x #{gem}"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment