[Rubygems-developers] [PATCH] gem unpack fails in gem isn't in the default repository

Laurent Sansonetti laurent.sansonetti at gmail.com
Mon Apr 7 20:38:50 EDT 2008


Hi,

I completely forgot about this one but I just received a duplicate bug
report :)

Would it be possible to fix that in the upcoming release? I am pretty
sure it's a safe change.

Laurent

On Tue, Jan 15, 2008 at 8:48 AM, Laurent Sansonetti
<laurent.sansonetti at gmail.com> wrote:
> Hi,
>
>  Currently with trunk, gem unpack fails if you pass it a gem that isn't
>  in the default gems repository, but another repository.
>
>  It is the case in Mac OS X 10.5, where there are 2 repositories, but
>  all pre-installed gems being in the non-default one.
>
>  $ ruby -r rubygems -e "p Gem.dir, Gem.path"
>  "/Library/Ruby/Gems/1.8"
>  ["/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8",
>  "/Library/Ruby/Gems/1.8"]
>
>  $ gem unpack termios
>  ERROR:  While executing gem ... (Gem::Exception)
>     Cannot load gem at
>  [/Library/Ruby/Gems/1.8/cache/termios-0.9.4.gem] in /Volumes/Data
>
>  The following patch fixes the problem.
>
>  $ gem unpack termios
>  Unpacked gem: '/Volumes/Data/termios-0.9.4'
>
>  Laurent
>
>  Index: lib/rubygems/commands/unpack_command.rb
>  ===================================================================
>  --- lib/rubygems/commands/unpack_command.rb     (revision 1594)
>  +++ lib/rubygems/commands/unpack_command.rb     (working copy)
>  @@ -73,7 +73,7 @@
>      # Furthermore, the name match must be exact (ignoring case).
>      if gemname =~ /^#{selected.name}$/i
>        filename = selected.full_name + '.gem'
>  -      return File.join(Gem.dir, 'cache', filename)
>  +      return Gem.path.map { |d| File.join(d, 'cache', filename)
>  }.find { |p| File.exist?(p) }
>      else
>        return nil
>      end
>


More information about the Rubygems-developers mailing list