# Gem API

**URL:** <https://www.ruby-forum.com/t/gem-api/127425>\
**Category:** Ruby\
**Created:** [January 29, 2008, 2:39am UTC](https://www.ruby-forum.com/t/gem-api/127425 "2008-01-29T02:39:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [January 29, 2008, 2:39am UTC](https://www.ruby-forum.com/t/gem-api/127425/1 "2008-01-29T02:39:10Z")

</div>

I’m curious is there a flag or an easy way to extend gem when calling  
it from the command line to do the following:  
remove lines such as:

\n\*\*\* LOCAL GEMS _**\n\n  
and  
\n**_ REMOTE GEMS \*\*\*\n\n

and to control the output formatting of  
gem list  
or of  
gem list -d  
?

I’d like to get that output in a more manageable format, but without  
permanently altering gem.  
I just want the easiest way to alter those methods when calling gem  
or calling gem via ruby at the command line…  
I don’t want to break any body’s gem tool, but I do want to use gem’s  
output for list.

I suppose I’ll need to include a file to use as an argument…  
ruby -rubygems filename.rb

What I am doing is building a gui wrapper in Cocoa on OS X for common  
gem commands.  
I want to later add gem install and gem uninstall, but I’m not sure  
what the best way would be to handle gems that have more involved  
install/uninstall processes, such as when the user is prompted for [y/  
n]? input on whether to include a dependency or something in that  
install/uninstall process.  
Is there a consistent thing I should look for in this or some API I  
can dig into?  
Same goes for gems that on install ask for such things as platform  
choice (the mysql gem is an example of this).

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [January 31, 2008, 12:13am UTC](https://www.ruby-forum.com/t/gem-api/127425/2 "2008-01-31T00:13:10Z")

</div>

On Jan 28, 2008, at 17:37 PM, John J. wrote:

> What I am doing is building a gui wrapper in Cocoa on OS X for  
> common gem commands.  
> I want to later add gem install and gem uninstall, but I’m not sure  
> what the best way would be to handle gems that have more involved  
> install/uninstall processes, such as when the user is prompted for  
> [y/n]? input on whether to include a dependency or something in that  
> install/uninstall process.

Talk to Chad Wooley. He’s writing a gem installer tool.

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [January 31, 2008, 5:27am UTC](https://www.ruby-forum.com/t/gem-api/127425/3 "2008-01-31T05:27:06Z")

</div>

On Jan 30, 2008, at 5:12 PM, Eric H. wrote:

> Talk to Chad Wooley. He’s writing a gem installer tool.

Ok, thanks,  
one other thing,  
I’d rather not go hacking gem, but If possible, as a feature request,  
can we have a flag that turns off the headings?  
From digging through gem’s code it certainly looks reasonably possible.  
things such as  
\n\*\*\* LOCAL GEMS \*\*\*\n\n

and  
Updating metadata for 13 gems…

It would be convenient as heck to have those easily turned off by a  
command line flag so that parsing the output is cleaner.  
How can I contact Chad Wooly?

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [January 31, 2008, 10:25am UTC](https://www.ruby-forum.com/t/gem-api/127425/4 "2008-01-31T10:25:23Z")

</div>

On Jan 30, 2008, at 20:26 PM, John J. wrote:

> > Talk to Chad Wooley. He’s writing a gem installer tool.
> 
> Ok, thanks,  
> one other thing,  
> I’d rather not go hacking gem, but If possible, as a feature request,  
> can we have a flag that turns off the headings?

No. If you’re going to be writing a tool, use the API the  
QueryCommand uses. If you find yourself duplicating too much, propose  
a patch to refactor into something more usable.

> From digging through gem’s code it certainly looks reasonably  
> possible.  
> things such as  
> \n\*\*\* LOCAL GEMS \*\*\*\n\n
> 
> and  
> Updating metadata for 13 gems…
> 
> It would be convenient as heck to have those easily turned off by a  
> command line flag so that parsing the output is cleaner.

The RubyGems API provides for this, investigate rubygems/  
user\_interaction.rb (I think)

> How can I contact Chad Wooly?

Check the archives of the rubygems-developers list for details.

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [January 31, 2008, 2:10pm UTC](https://www.ruby-forum.com/t/gem-api/127425/5 "2008-01-31T14:10:35Z")

</div>

On Jan 31, 2008, at 3:24 AM, Eric H. wrote:

> > >
> 
> The RubyGems API provides for this, investigate rubygems/  
> user\_interaction.rb (I think)
> 
> > How can I contact Chad Wooly?
> 
> Check the archives of the rubygems-developers list for details.

Many thanks!  
I will look into these things! (as time permits… )
