Skip to content

Instantly share code, notes, and snippets.

@theotherzach
Last active January 3, 2016 07:49
Show Gist options
  • Save theotherzach/8432230 to your computer and use it in GitHub Desktop.
Save theotherzach/8432230 to your computer and use it in GitHub Desktop.
input = ARGF.read
lines = input.split("\n").select { |line|
!line.empty? && !line.include?("***")
}.map { |line|
{
gemname: line.split(" ").first,
version: line.split(" ").last.gsub(/[(|)]/, ""),
}
}
puts %{ source "https://rubygems.org" \n\n}
lines.each do |line|
begin
puts %{gem "#{line[:gemname]}" }
rescue Errno::EPIPE
exit(74)
end
end
@theotherzach
Copy link
Author

gem list --no-details -l | ruby gemlist_parser.rb > Gemfile

@cczona
Copy link

cczona commented Jan 15, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment