Skip to content

Instantly share code, notes, and snippets.

@itspriddle
Created May 3, 2009 07:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itspriddle/105886 to your computer and use it in GitHub Desktop.
Save itspriddle/105886 to your computer and use it in GitHub Desktop.
# copy_gems.rb
# Run on Computer A to generate copy_gems.sh
# Run copy_gems.sh on Computer B to install all gems (including all versions)
list = `sudo gem list --local`
output = "#!/bin/bash\n"
list.each_line do |line|
name, ver = line.split(" (")
ver.gsub(/[\(|\)]/, '').split(', ').each { |v| output << "sudo gem install #{name.chomp} -v #{v.chomp} --no-rdoc --no-ri\n" }
end
File.open("copy_gems.sh", "w") { |f| f.write(output) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment