You can create your own implementation of StreamUI. and use that in place of the default StreamUI in Gem::CommandManager. That may seem "messy, but I believe this is the mechanism that was built into rubygems for doing this, and it works pretty well - except for where someone forgot to use it - see http://rubyforge.org/tracker/index.php?func=detail&aid=9020&group_id=126&atid=577
For an example of overriding StreamUI to intercept the IO streams, check out geminstaller.rubyforge.org, and look at gem_runner_proxy, and enhanced_stream_ui. -- Chad On 3/14/07, Patrick Hurley <[EMAIL PROTECTED]> wrote: > Sorry, if I should have been able to find some docs to point me in the > right direction, but so far here is what I figured out from trial and > error and some source code reading. > > I want to unpack a gem already on my machine: > gem unpack a_gem > > Then I want to retrieve the gem spec > gem specification a_gem > > (then more stuff but this will get me started) > > So far I have the simple code: > > require "rubygems" > Gem.manage_gems > > if gem = ARGV.first > puts "Processing #{gem}" > runner = Gem::GemRunner.new > puts "Unpack #{gem}" > runner.run ['unpack', gem] > runner.run(['specification', gem]) > end > > This works; however, the run command displays to the screen. Is there > an easy way to capture its output? I see there is a default interface > object, with a method called say I could grab, but that seems pretty > messy. I could also grab the stdout handle and play games there, but > again, I feel I am missing something. > > Thanks in advance for your time > pth > _______________________________________________ > Rubygems-developers mailing list > Rubygems-developers@rubyforge.org > http://rubyforge.org/mailman/listinfo/rubygems-developers > _______________________________________________ Rubygems-developers mailing list Rubygems-developers@rubyforge.org http://rubyforge.org/mailman/listinfo/rubygems-developers