[Rubygems-developers] Question: rake test requires rake outside GEM_PATH

Eric Hodel drbrain at segment7.net
Mon Apr 13 16:42:58 EDT 2009


On Apr 13, 2009, at 05:23, Luis Lavena wrote:
> On Sun, Apr 12, 2009 at 4:41 PM, Daniel Berger <djberg96 at gmail.com>  
> wrote:
>> Luis Lavena wrote:
>>>
>>> Hello Guys,
>>>
>>> I have multiple versions of ruby installed, ranging from 1.8.5 to
>>> 1.8.6, p114 and p368.
>>>
>>> To reduce duplication of common used gems, I set both GEM_HOME and
>>> GEM_PATH to my user folder:
>>>
>>> D:/Users/Luis/.gem/ruby/1.8
>>>
>>> I can run rake or any other gem without any kind of issue.
>>>
>>> I've noticed that when running some RubyGems test, rake is invoked,
>>> and is failing:
>>>
>>>  18) Error:
>>> test_path_ok_eh_legacy(TestGemUninstaller):
>>> Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem  
>>> native
>>> extension.
>>>
>>> D:/Users/Luis/ruby/ruby-1.8.6-p368-i386-mingw32/bin/ruby.exe
>>> mkrf_conf.rb --build_arg1 --build_arg2
>>>
>>> rake RUBYARCHDIR=D:/Temp/test_rubygems_2712/gemhome/gems/a-2/lib
>>> RUBYLIBDIR=D:/Temp/test_rubygems_2712/gemhome/gems/a-2/lib
>>>
>>> D:/Users/Luis/ruby/ruby-1.8.6-p368-i386-mingw32/lib/ruby/site_ruby/ 
>>> 1.8/rubygems.rb:636:in
>>> `report_activate_error': Could not find RubyGem rake (>= 0)
>>> (Gem::LoadError)
>>>        from
>>> D:/Users/Luis/ruby/ruby-1.8.6-p368-i386-mingw32/lib/ruby/site_ruby/ 
>>> 1.8/rubygems.rb:141:in
>>> `activate'
>>>        from
>>> D:/Users/Luis/ruby/ruby-1.8.6-p368-i386-mingw32/lib/ruby/site_ruby/ 
>>> 1.8/rubygems.rb:49:in
>>> `gem'
>>>        from D:/Users/Luis/.gem/ruby/1.8/bin/rake:18
>>>
>>> The rake from my GEM_HOME is invoked, but looks like ENV['GEM_HOME']
>>> and 'GEM_PATH' were tweaked, so it can no longer find that gem, thus
>>> failing.
>>
>> Can you see where and why?
>>
>
> test/gemutilities.rb:134 (teardown).
>
> Is doing a cleanup, but not doing a safeguard of the values prior  
> resetting.
>
>>> I wonder if this could affect other applications too, and what could
>>> ge the workaround besides .gemrc, since I've also 1.9.1 and want to
>>> avoid mixing the gem repositories between the two.
>>
>> Seems reasonable.
>>
>
> Besides RubyGems own tests, couldn't find other being affected by
> this, so is good.

RubyGems tweaks GEM_HOME and GEM_PATH to point to a temporary test  
directory to avoid writing to files it shouldn't.

For tests that need rake, rake could be installed into the temporary  
test directory.


More information about the Rubygems-developers mailing list