# Rubygems front end?

**URL:** <https://www.ruby-forum.com/t/rubygems-front-end/70385>\
**Category:** Ruby\
**Created:** [September 28, 2006, 7:37pm UTC](https://www.ruby-forum.com/t/rubygems-front-end/70385 "2006-09-28T19:37:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ezra\_z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f07891/32.png) [@ezra\_z](https://www.ruby-forum.com/u/ezra_z)\
**Post date:** [September 28, 2006, 7:37pm UTC](https://www.ruby-forum.com/t/rubygems-front-end/70385/1 "2006-09-28T19:37:08Z")

</div>

Does one exist? I wanted to have a look at how one would go about  
it. Or to be more specific, I need to make a web interface that I can  
use to search the available gems, and list their descriptions and  
versions. I can use the normal gem command line to actually install  
stuff. But I want to do quick local auto complete searches of  
available gems.

```
Basically all I need is the info that comes from a gem list --

```

remote. But I want to pull this info every few hours and insert it  
into my database so I can use it in my web interface. What would be  
the most polite way of doing this as far as rubygems are concerned?  
Should I just parse the gem list --remote with regexes? Doesn’t seem  
like the way to go really. And [http://docs.rubygems.org/](http://docs.rubygems.org/) is down  
right now so I can’t read up on it.

```
Is there an easier way to do this built into rubygems already? I

```

suppose my next step will be to just read the source and figure it  
out but if anyone has suggestions then please let me know,.

Cheers-  
-Ezra

---

<div class="post-metadata">

**Author:** ![ezra\_z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f07891/32.png) [@ezra\_z](https://www.ruby-forum.com/u/ezra_z)\
**Post date:** [September 29, 2006, 10:35am UTC](https://www.ruby-forum.com/t/rubygems-front-end/70385/2 "2006-09-29T10:35:40Z")

</div>

Ezra Z. wrote:

> Does one exist?

There is the beginnings of a project at ‘rubyslippers’ on Rubyforge.  
[last activity 18 months ago.]

And I thought I had seen something with a ‘native’ GUI [rubyslippers  
uses rwd] but I can’t find it…

Also, there was this thread on rubygems-developers -

[http://rubyforge.org/pipermail/rubygems-developers/2004-March/000176.html](http://rubyforge.org/pipermail/rubygems-developers/2004-March/000176.html)

hth

deejay

---

<div class="post-metadata">

**Author:** ![ezra\_z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f07891/32.png) [@ezra\_z](https://www.ruby-forum.com/u/ezra_z)\
**Post date:** [September 29, 2006, 3:12pm UTC](https://www.ruby-forum.com/t/rubygems-front-end/70385/3 "2006-09-29T15:12:17Z")

</div>

The Gem.source\_index contains a source index object that contains lots  
of information on available packages.

---

<div class="post-metadata">

**Author:** ![ezra\_z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f07891/32.png) [@ezra\_z](https://www.ruby-forum.com/u/ezra_z)\
**Post date:** [September 29, 2006, 5:33pm UTC](https://www.ruby-forum.com/t/rubygems-front-end/70385/4 "2006-09-29T17:33:02Z")

</div>

Thanks for the responses. I ended up just regexing the gem list –  
remote output as it was simple to do. I’ll share here in case someone  
else ends up wanting something like this. Here is a rake task that  
will pull the gem list and parse it into a hash with he name of the  
gem as the key and versions and descriptions as subhashes of the gem  
name key. THen it populates a bunch of GemIndex ActiveRecord Objects.

namespace :parsegems do  
def parse\_gems(gem\_list)  
hsh={}  
last = ‘’  
gem\_list.each do |line|  
case line  
when /(\w+)\s+((._?))/  
(hsh[$1] ||= {})[:versions]=$2  
last = $1  
when /\A(\s+\w._?)\Z/  
(hsh[last][:desc] ||= ‘’) \<\< ($1+’ ')  
end  
end  
hsh  
end

desc ‘Gets the gems list --remote and parse it into the app\_gems  
database table for quick autocomplete.’  
task :import =\> :environment do  
hsh = parse\_gems(`gem list --remote`)  
hsh.keys.each do |key|  
g = GemIndex.find\_or\_create\_by\_name(key)  
g.update\_attributes :versions =\> hsh[key][:versions],  
:description =\> hsh[key][:desc]  
puts “Imported Gem Data for: #{key}”  
end  
end

end

Cheers-  
-Ezra
