[Rubygems-developers] SourceInfoCache.search (Eric Hodel)

Eric Hodel drbrain at segment7.net
Sat Sep 22 05:45:43 EDT 2007


On Sep 21, 2007, at 23:23, Alan C Francis wrote:
>>> There's actually an ugly way to do it.  E.g.:
>>>
>>>  Gem::SourceInfoCache.new.cache_data.values.map{|s|
>>> s.source_index.map{|g| g.first}}.flatten
>>
>> It would be best if we could work with the data on-hand.  I don't
>> know how to determine when we're too stale though.
>
> It could be left up to users ?   Some options:
>
> a) a flag on install / list
> b) update local cache only on 'outdated' or 'update'
> c) go the apt route and add a command specifically to refresh the
> local cache.
>
> In any case, even if the default 'gem' behaviour was to *always*
> update before any operation, and there was no CLI command to do it,
> providing a programmatic way to search the local cache would be
> useful for tool developers (by which, of course, I mean specifically
> me :).

I think I would like:

If Gem.configuration.update_sources is true (default) the source  
cache will be updated automatically.

Add `gem sources --update` (or -u) to force a source cache update.

You should then be able to override the user's  
Gem.configuration.update_sources value for your purposes.

I don't have time to write it.  Could you write up a patch and put it  
in the tracker?  (Don't forget tests!)

--
Poor workers blame their tools. Good workers build better tools. The
best workers get their tools to do the work for them. -- Syndicate Wars




More information about the Rubygems-developers mailing list