You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@buildr.apache.org by Pepijn Van Eeckhoudt <pe...@luciad.com> on 2010/03/16 11:44:01 UTC

Deprecated gem api usage

When declaring required gems via build.yml buildr claims the gems in 
question cannot be located. It seems this is due to use of old rubygems 
api in util.rb. Currently at line 129 it uses SourceCacheIndex to find 
gems. This reports that it can't find any gems. I inspected the index 
files that this command retrieves from the gem servers and this 
effectively only contains a single gem.
I then checked the gem query command source code and it turns out there 
a newer class, SpecFetcher, is used instead of SourceCacheIndex. A 
discussion on the rubygems-developers list 
(http://www.mail-archive.com/rubygems-developers@rubyforge.org/msg02087.html) 
seems to conclude that the SourceCacheIndex stuff should not be used 
anymore.
I replaced line 129 with a line I derived from the query command source:
remote = dependencies.map{ |dep| Gem.source_index.search(dep).last || 
Gem::SpecFetcher.fetcher.fetch( dep, true ).map{ |spec, source| spec 
}.last }
After this change gem searching and retrieval works correctly.

So, should the gem autoinstallation stuff be updated?

Pepijn

Re: Deprecated gem api usage

Posted by Pepijn Van Eeckhoudt <pe...@luciad.com>.
BUILDR-403 describes this issue and includes a patch that introduces a 
spec for the current functionality. It's not an ideal unit test as it 
may need to go online, but it's the best I could come up with for this 
bit of functionality.
The fix is described in the description of the issue.

Pepijn

On 16/3/2010 17:18, Antoine Toulme wrote:
> Sure. If you file a bug with a patch, we will try to apply it and work on a
> spec.
>
> On Tue, Mar 16, 2010 at 03:44, Pepijn Van Eeckhoudt<
> pepijn.vaneeckhoudt@luciad.com>  wrote:
>
>    
>> When declaring required gems via build.yml buildr claims the gems in
>> question cannot be located. It seems this is due to use of old rubygems api
>> in util.rb. Currently at line 129 it uses SourceCacheIndex to find gems.
>> This reports that it can't find any gems. I inspected the index files that
>> this command retrieves from the gem servers and this effectively only
>> contains a single gem.
>> I then checked the gem query command source code and it turns out there a
>> newer class, SpecFetcher, is used instead of SourceCacheIndex. A discussion
>> on the rubygems-developers list (
>> http://www.mail-archive.com/rubygems-developers@rubyforge.org/msg02087.html)
>> seems to conclude that the SourceCacheIndex stuff should not be used
>> anymore.
>> I replaced line 129 with a line I derived from the query command source:
>> remote = dependencies.map{ |dep| Gem.source_index.search(dep).last ||
>> Gem::SpecFetcher.fetcher.fetch( dep, true ).map{ |spec, source| spec }.last
>> }
>> After this change gem searching and retrieval works correctly.
>>
>> So, should the gem autoinstallation stuff be updated?
>>
>> Pepijn
>>
>>      
>    


-- 
Pepijn Van Eeckhoudt - Project Leader
T +32 16 23 95 91
F +32 16 29 34 22 | pepijn.vaneeckhoudt@luciad.com

LUCIAD - high performance visualization
Wetenschapspark Arenberg | Gaston Geenslaan 9
3001 Leuven | Belgium | www.luciad.com



Re: Deprecated gem api usage

Posted by Pepijn Van Eeckhoudt <pe...@luciad.com>.
Quoting "Antoine Toulme" <an...@lunar-ocean.com>:

> Sure. If you file a bug with a patch, we will try to apply it and work on a
> spec.
I was thinking about a spec for this one, but I'm not quite sure how  
this could be done. Maybe a find_gem method should be extracted from  
install and then a spec could be written for that instead?

Pepijn

>
> On Tue, Mar 16, 2010 at 03:44, Pepijn Van Eeckhoudt <
> pepijn.vaneeckhoudt@luciad.com> wrote:
>
>> When declaring required gems via build.yml buildr claims the gems in
>> question cannot be located. It seems this is due to use of old rubygems api
>> in util.rb. Currently at line 129 it uses SourceCacheIndex to find gems.
>> This reports that it can't find any gems. I inspected the index files that
>> this command retrieves from the gem servers and this effectively only
>> contains a single gem.
>> I then checked the gem query command source code and it turns out there a
>> newer class, SpecFetcher, is used instead of SourceCacheIndex. A discussion
>> on the rubygems-developers list (
>> http://www.mail-archive.com/rubygems-developers@rubyforge.org/msg02087.html)
>> seems to conclude that the SourceCacheIndex stuff should not be used
>> anymore.
>> I replaced line 129 with a line I derived from the query command source:
>> remote = dependencies.map{ |dep| Gem.source_index.search(dep).last ||
>> Gem::SpecFetcher.fetcher.fetch( dep, true ).map{ |spec, source| spec }.last
>> }
>> After this change gem searching and retrieval works correctly.
>>
>> So, should the gem autoinstallation stuff be updated?
>>
>> Pepijn
>>
>




Re: Deprecated gem api usage

Posted by Antoine Toulme <an...@lunar-ocean.com>.
Sure. If you file a bug with a patch, we will try to apply it and work on a
spec.

On Tue, Mar 16, 2010 at 03:44, Pepijn Van Eeckhoudt <
pepijn.vaneeckhoudt@luciad.com> wrote:

> When declaring required gems via build.yml buildr claims the gems in
> question cannot be located. It seems this is due to use of old rubygems api
> in util.rb. Currently at line 129 it uses SourceCacheIndex to find gems.
> This reports that it can't find any gems. I inspected the index files that
> this command retrieves from the gem servers and this effectively only
> contains a single gem.
> I then checked the gem query command source code and it turns out there a
> newer class, SpecFetcher, is used instead of SourceCacheIndex. A discussion
> on the rubygems-developers list (
> http://www.mail-archive.com/rubygems-developers@rubyforge.org/msg02087.html)
> seems to conclude that the SourceCacheIndex stuff should not be used
> anymore.
> I replaced line 129 with a line I derived from the query command source:
> remote = dependencies.map{ |dep| Gem.source_index.search(dep).last ||
> Gem::SpecFetcher.fetcher.fetch( dep, true ).map{ |spec, source| spec }.last
> }
> After this change gem searching and retrieval works correctly.
>
> So, should the gem autoinstallation stuff be updated?
>
> Pepijn
>