Skip to content

Instantly share code, notes, and snippets.

@quackingduck
Created November 25, 2009 03:58
Show Gist options
  • Save quackingduck/242458 to your computer and use it in GitHub Desktop.
Save quackingduck/242458 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
gems = File.read(ARGV[0] || 'app.rb').grep(/^gem/).map { |l| l.match(/gem\s+['"]([^'"]+?)['"],\s*['"]([^'"]+?)['"]/).captures }
gems_file = gems.map { |name,version| name + ' --version=' + version }.join("\n") + "\n"
File.open('.gems','w') { |f| f.write gems_file }
puts gems_file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment