Skip to content

Instantly share code, notes, and snippets.

@actsasflinn
Forked from r38y/install_gems.rb
Created April 27, 2009 02:12
Show Gist options
  • Save actsasflinn/102286 to your computer and use it in GitHub Desktop.
Save actsasflinn/102286 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# use this to install the same gems you have installed under one ruby in another
# run "gem list > ~/Desktop/gems.txt"
# run "ruby install_gems.rb /Users/r38y/Desktop/gems.txt"
gems = IO.readlines(ARGV.first)
gems.map! do |g|
stuff = g.split(' ')
gem_name = stuff.delete_at(0)
stuff.map{|v| v.gsub(/[\(\)\,]/, '')}.map{|v| "sudo gem install #{gem_name} -v=#{v}"}
end.flatten!
gems.each do |g|
puts "running '#{g}'"
`#{g}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment