0

I need to extract information from a gem such as its summary, authors and version and I need to do it in Ruby code and with the gem still compressed in a .tar file. Can someone help me?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Mario
  • 1
  • You need to tell us what you've tried and why that didn't work. As is, it looks like you haven't tried anything and want someone to do the research and work for you. – the Tin Man Sep 10 '14 at 17:48

1 Answers1

0

You should use gem contents GEMNAME [GEMNAME ...] [options] to get the information of the gem. You can read up on all the most useful gem commands in the following articles:

  1. 25 Gem Commands for RubyGems
  2. Ruby Gems Guide.

If you need to do this in ruby, you can invoke a bash command using ruby and then pipe that output to the appropriate stream.

Please let me know if you have any questions!

Community
  • 1
  • 1
Devarsh Desai
  • 5,984
  • 3
  • 19
  • 21
  • 1
    Instead of saying "here and here", put some usable anchor-text that describes what the people are clicking on so they can decide whether they want to go there prior to a click. See [Don't use "click here" as link text](http://www.w3.org/QA/Tips/noClickHere) and the W3's "[6.1 Link text](http://www.w3.org/TR/WCAG10-HTML-TECHS/#link-text)" documentation. – the Tin Man Sep 10 '14 at 17:52
  • @theTinMan, ahh I see! Thank you for the advice in better the responses, I sincerely appreciate it! :-) – Devarsh Desai Sep 10 '14 at 17:55
  • 1
    I, and the rest of Stack Overflow, appreciate when the content improves. Making it easier to use helps everyone. – the Tin Man Sep 10 '14 at 18:01
  • Thank you for your help but I was hoping for a way to extract the .gemspec file from inside a .gem file in ruby code I already know that I can do this with $gem spec --ruby [GEMNAME] > [GEMNAME].gemspec but I don't want to use a bash command instead I'd rather doing this using a ruby class with a ruby method. I would appreciate some help. Thanks – Mario Sep 15 '14 at 12:38
  • hey mario, I understand; I've been digging around the past hour and I'm not able to find any pre-built ruby commands which will do this for you. You can build a simple ruby I/O wrapper which parses the information from the .gemspec file and make those methods available as a gem. Using this resource (http://rubymonk.com/learning/books/1-ruby-primer/chapters/42-introduction-to-i-o/lessons/90-using-the-file-classhttp://rubymonk.com/learning/books/1-ruby-primer/chapters/42-introduction-to-i-o/lessons/90-using-the-file-class), it would take < a couple of hours. Please let me know if you have q's! – Devarsh Desai Sep 15 '14 at 17:26