[Rubygems-developers] GUI Interfacing with rubygems?

Eric Hodel drbrain at segment7.net
Thu Dec 28 14:51:14 EST 2006

On Dec 28, 2006, at 04:18, Eloy Duran wrote:
> I'm trying to create an Mac OS X interface to rubygems which should  
> be part of an RubyCocoa IDE.
> I've looked at another application (rubyslippers) which has a GUI  
> for rubygems, but it seems to me that it just uses the 'gem'  
> command line tool.  Which is an option, but I would prefer to be  
> able to use some public Gem api if available.
> Right now I did some testing with the internals of rubygems like:
> <code>
> require 'rubygems/remote_installer'
> require 'yaml'

You shouldn't need to require yaml.

> query = 'event'
> result = Gem::RemoteInstaller.new().search(query)

This method no longer exists, you'll now find it over on  
Gem::SourceInfoCache where it makes more sense.

> </code>
> which returns an array of gems that have 'event' in their name, but  
> it doesn't for instance group them like the results shown on the  
> command line.
> So for a gem like 'eventmachine' instead of 1 result with multiple  
> versions I would get multiple 'eventmachine' results for the  
> different versions available.

You can convert a list of matches into the results you want with  
about five lines of code.  Internally, having them grouped the way  
the command line does makes things much more difficult.

> Also it only searches based on the title of the gem, not the  
> description...

RubyGems provides no built-in way of searching descriptions.

> So to wrap it up, I could of course revert to wrapping the 'gem'  
> command line tool, and maybe even scraping the rubyforge.org search  
> results page (because it also searches on the description).

rubyforge.org does not search the gem descriptions.

> But I rather wouldn't. Could someone tell me if such an interface  
> exists and maybe point me to some documentation or an example??

I've done a bunch of work to make RubyGems more scriptable for  
0.9.1.  Try out the recent beta (

Unfortunately, too much code lives in lib/rubygems/gem_commands.rb  
that should live elsewhere.  I'm doing what I can to correct this,  
which will make everyone's lives better.

Eric Hodel - drbrain at segment7.net - http://blog.segment7.net


More information about the Rubygems-developers mailing list