[Rubygems-developers] GUI Interfacing with rubygems?

Chad Woolley thewoolleyman at gmail.com
Thu Dec 28 14:42:18 EST 2006

Hey Eloy,

I've done this in my GemInstaller project:

This is almost ready for release.  I didn't know about rubyslippers
until now, I'm going to look at it, because I've run into a few
hitches.  Maybe it will give me some ideas.  The biggest problems I've
run into are:

* There's no really cohesive API for RubyGems.  Whether you use the
command line or the api, you have to do parsing out text and acting on
it (parsing versions/platforms/etc).  If you want to use it
programatically, you have to hit a few classes.  I've got proxies for
GemRunner and SourceIndex, and some mixin hacks for StreamUI so I can
intercept stdin and stdout.

* Specifying platforms for multiplatform gems.  Currently, there is no
way to specify platform via a command line option or API.  It's
hardcoded to always present a list if theres a binary (non-ruby) gem,
and ask for the user to make a choice via stdin (which I had to work
around with the mixin hacks for StreamUI).  There is talk of changing
this, but the developers want to gather data on what platforms people
use first.  I'd really like to just get a command line option for
platform added ASAP - hint hint :)

*  Dealing with sudo.  This is currently my only remaining blocker for
releasing geminstaller.  Must people have rubygems installed as root,
so commands that modify the gem repository must be run via sudo.  I
would like to have a command line option --sudo which uses sudo to run
gems, but this doesn't work if you are calling into the API
programatically.  On the other hand, I could use the command line
interface, but this is also tricky in ruby, to properly deal with
stderr, stdin, and timeouts if the gem command is expecting different
stdin than you think it is.  Also, if you use the command line, you
have to parse errors out of stdout/stderr as opposed to just catching
exceptions.  If anyone has ideas here, please let me know.

Like I said, I'll look into RubySlippers and see if it gives me any
ideas to deal with these problems.  Please feel free to contact me
directly if you'd like to collaborate, I'm thewoolleyman at gmail.com.

-- Chad W.

On 12/28/06, Eloy Duran <eloy.de.enige at gmail.com> wrote:
> Hello,
> 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'
> query = 'event'
> result = Gem::RemoteInstaller.new().search(query)
> </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.
> Also it only searches based on the title of the gem, not the description...
> 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).
> But I rather wouldn't. Could someone tell me if such an interface
> exists and maybe
> point me to some documentation or an example??
> Kind regards,
> Eloy
> _______________________________________________
> Rubygems-developers mailing list
> Rubygems-developers at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rubygems-developers

More information about the Rubygems-developers mailing list