Skip to content

Instantly share code, notes, and snippets.

@r38y
Created April 27, 2009 02:03
Show Gist options
  • Save r38y/102283 to your computer and use it in GitHub Desktop.
Save r38y/102283 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 ~/Desktop/gems.txt"
# You may have to change which ruby you use to run this so the gems get installed
# in the right place, for instance, using the REE ruby specifically while your server
# is running on another version... basically, think about what you're doing.
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