.gemspec文件我在创建gem时仔细记录了,如何访问其内容?具体来说,我想访问gem.description和gem.summary条目,因为我在那里放了一些非常有用的信息。
答案 0 :(得分:4)
我希望有一个比这更好的答案,阅读YAML可能很烦人,但你可以使用gem specification GEMNAME
。这会吐出很多信息,你可能想把它传递给grep。
答案 1 :(得分:2)
您可以通过将gem specification
的输出汇总到某个内容来提供更易读的输出。
这可以更清晰,特别是当描述是多行字符串时:
% 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