Last active
December 19, 2015 18:58
-
-
Save deevis/6002077 to your computer and use it in GitHub Desktop.
Print out all Gems and their descriptions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'prawn' | |
Prawn::Document.generate("gems.pdf") do | |
`bundle list`.split("\n")[1..-1].map{|s| s.gsub(" * ","")}.each do |g| | |
puts g | |
text "\n\n<b>#{g}</b>", inline_format: true | |
text "---------------------------" | |
s = `gem specification #{g.split.first}` rescue "" | |
description = s.scan( /.*\ndescription: (.*)\nemail.*/m ).last.first rescue nil | |
if !description || description.empty? | |
description = s.scan( /.*\nsummary: (.*)\ntest.*/m ).last.first rescue "" | |
end | |
text description | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment