Rubygems front end?

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/ 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

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

hth

deejay

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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs