[Rubygems-developers] Persistent URI for rubyforge rubygems downloads?

Jeremy Hinegardner jeremy at hinegardner.org
Tue Nov 11 11:51:18 EST 2008

On Tue, Nov 11, 2008 at 04:26:27AM -0700, Chad Woolley wrote:
> On Tue, Nov 11, 2008 at 4:06 AM, James Tucker <jftucker at gmail.com> wrote:
> >
> > With rubygems, you could even pack up a little trick to install from the
> > rubygems_update package and use a query on the source_index to find it
> > maybe, or keep a yaml file with a pointer to the current version, or
> > whatever.
> >
> Right, but I'm mostly concerned about clean installs or reinstalls from the
> tarball.  If you already have rubygems > 1.2.0, you can just use the normal
> auto-update method.

The rubyforge gem itself gets you almost all the way there.  This script will
get you the latest release_id of rubygems, and its one more step to scrape the
rubyforge page to get the download id, which is not built into the rubyforge
gem, but wouldn't be all that extra to add to it if someone was so inclined.

  % cat rubygems-latest-version.rb
  #!/usr/bin/env ruby

  require 'rubygems'
  require 'rubyforge'

  # assuming you already have a rubyforge account and have manually run
  # 'rubyforge login'
  rf = RubyForge.new
  rubygem_releases = rf.autoconfig['release_ids']['rubygems']
  versions = {}
  rubygem_releases.each do |k,v|
    next unless Gem::Version.correct?( k )
    versions[ Gem::Version.new( k ) ] = v

  latest_version = versions.keys.sort.last
  puts "Latest Version : #{latest_version}"
  puts "Release id     : #{versions[latest_version]}"

Or, strip out all the needed functionality from the rubyforge gem and go that
route.  Which might be a better way to go if you are possibly on a machine with
only a fresh install of ruby.



 Jeremy Hinegardner                              jeremy at hinegardner.org 

More information about the Rubygems-developers mailing list