fooxblut
fooxblut

Reputation: 45

gem cmd from a ruby script

I want to check with "gem outdated" if there are any gem updates. Is it possible to get the result of the gem software in a script as string or value?

I don't want to execute system() oder something similar.

thanks for your help

Upvotes: 0

Views: 253

Answers (2)

andrykonchin
andrykonchin

Reputation: 2582

It's can help you

require 'rubygems/commands/outdated_command.rb'

g = Gem::Commands::OutdatedCommand.new()
g.execute()
# => [] for me ))

You can find other commands in directory lib/ruby/1.9.1/rubygems/commands/

Upvotes: 1

Jörg W Mittag
Jörg W Mittag

Reputation: 369594

RubyGems is actually a library, the gem commandline tool is only a small wrapper around that library. You can do anything you can do with the commandline tool from that library (and indeed some things you can't do with the commandline tool).

However, the library API is not as well documented as the commandline tool's parameters. There is a testuite, though.

Upvotes: 1

Related Questions