Skip to content

Instantly share code, notes, and snippets.

@Atalanta
Created August 11, 2011 22:23
Show Gist options
  • Save Atalanta/1140962 to your computer and use it in GitHub Desktop.
Save Atalanta/1140962 to your computer and use it in GitHub Desktop.
gems = %x[gem list --local 2>/dev/null]
installed_gems = {}
gems.each do |g|
gem, versions = g.split(' ',2)
installed_gems[gem] = versions.scan(/[\w\.]+/)
end
installed_gems.each do |gem,versions|
versions.each do |version|
puts "gem install #{gem} -v=#{version}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment