Skip to content

Instantly share code, notes, and snippets.

@fields
Created April 1, 2014 13:37
Show Gist options
  • Save fields/9914120 to your computer and use it in GitHub Desktop.
Save fields/9914120 to your computer and use it in GitHub Desktop.
make a Gemfile from currently installed gems
#!/usr/bin/env ruby
gems = `gem list`
puts "source https://rubygems.org"
gems.each_line{|line|
(gem, versions) = line.split(' ')
highest_version = versions.split(',').first.gsub(/[\(\)]/, '')
puts "gem '#{gem}', '#{highest_version}'"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment