This project is archived and is in readonly mode.

#3048 ✓wontfix
Mike Perham

gem install fails when a gem requires multiple sources

Reported by Mike Perham | August 13th, 2009 @ 07:01 PM

I have a gem on github. It depends on a gem at rubyforge.

  config.gem 'mperham-right_aws', :source => '', :version => '1.10.1', :lib => 'right_aws'

This will fail to install via rake gems:install since the source parameter overrides any other RubyGems sources so gem will not look at rubyforge for the dependency. I think the simplest fix is to just add rubyforge as an additional source if a source is specified:


      def install_command
        cmd = %w(install) << name
        cmd << "--version" << %("#{requirement.to_s}") if requirement
        cmd << "--source"  << @source  if @source
+       cmd << "--source"  << '' if @source

My gem installs as expected with this change.

Comments and changes to this ticket

  • Matt Jones

    Matt Jones August 17th, 2009 @ 03:59 PM

    This is not a correct behavior - we don't want to be hardcoding gem server locations. It's actually a known issue in RubyGems, not Rails. The correct thing to do here would be to extract all of the gem sources that Rubygems knows about and add them all to the string - maybe you'd be interested in writing that patch?

    I'd also point out that the :source option is only required if the user doesn't have added as a source globally; that's a lot more likely now than it was, say, a year ago.

  • Mike Perham

    Mike Perham August 17th, 2009 @ 04:25 PM

    Agreed that this is a RubyGems bug. I'll write the patch if I have some free time soon.

  • Mike Perham

    Mike Perham August 17th, 2009 @ 11:46 PM

    Patch to add all Gem.sources to cmd line.

  • CancelProfileIsBroken

    CancelProfileIsBroken September 25th, 2009 @ 12:52 PM

    • Tag changed from gem to bugmash, gem
  • Erik Ostrom

    Erik Ostrom September 26th, 2009 @ 05:19 AM

    +1 verified the behavior, the test, and the patch. Seems like this is a good workaround for a failing in RubyGems.

  • Elise Huard
  • Matt Jones

    Matt Jones September 26th, 2009 @ 08:38 PM

    The patch looks reasonable, but there's one case I'm a little concerned about: what if there's a gem name collision between the various pre-configured servers? In other words, has a gem named SomeGem, and another server also has one with the same name (potentially different versions; possibly even different authors).

    The Rubygems interpretation of --source will allow a user to disambiguate which one they mean, but this patch removes that functionality. Maybe an :exclusive_source option would be handy as well?

  • Rizwan Reza

    Rizwan Reza January 21st, 2010 @ 07:15 AM

    • State changed from “new” to “wontfix”
    • Tag changed from bugmash, gem to gem

    I think this is out of question as Rails 3.0 is using Bundler (or Bubble).

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket