How do I view my gem's (or any other gem's) gem.description and gem.summary texts (.gemspect items) from the command line?

StackOverflow https://stackoverflow.com/questions/11424971

Question

The .gemspec file I so carefully documented when I created my gem, how do I access its contents? Specifically I'd like to access the gem.description and gem.summary entries because I put some very useful info in there.

Was it helpful?

Solution

I hope there is a better answer than this, reading YAML can be annoying, but you can use gem specification GEMNAME. This will spit out a lot of information, you might want to pipe that to grep.

OTHER TIPS

You can provide a slightly more readable output by piping the output of gem specification to something to pull out what you want.

This can be much more legible, especially when the description is a multiline string:

% gem specification rack description | ruby -ryaml -e 'puts YAML.load(STDIN.read)'
Rack provides a minimal, modular and adaptable interface for developing
web applications in Ruby.  By wrapping HTTP requests and responses in
the simplest way possible, it unifies and distills the API for web 
servers, web frameworks, and software in between (the so-called
middleware) into a single method call.

Also see http://rack.github.com/.

% gem specification hoe description | ruby -ryaml -e 'puts YAML.load(STDIN.read)'
Hoe is a rake/rubygems helper for project Rakefiles. It helps you 
manage, maintain, and release your project and includes a dynamic
plug-in system allowing for easy extensibility. Hoe ships with
plug-ins for all your usual project tasks including rdoc generation,
testing, packaging, deployment, and announcement..

See class rdoc for help. Hint: `ri Hoe` or any of the plugins listed
below.

For extra goodness, see: http://seattlerb.rubyforge.org/hoe/Hoe.pdf
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top