[Rubygems-developers] Source caches again.

Hugh Sasse hgs at dmu.ac.uk
Fri Sep 21 04:51:25 EDT 2007


On Thu, 20 Sep 2007, Eric Hodel wrote:

> On Aug 29, 2007, at 10:38, Hugh Sasse wrote:
> > On Wed, 29 Aug 2007, I wrote:
> >
> >> Thanks.  I managed to miss that.
> >>
> >> :r! gem help source | grep cache | wc
> >>        0       0       0
> >>
> >> no mention of the cache in there.  I'll try to work up a doc patch
> >>
> >>         Hugh
> >
> > I've come up with this so far. Not as nice as I'd like, the  
> > duplication
        [...]
> > here can come up with something better.  This is untested as yet,  
> > by the
> > way, so beware.  A patch against the unpacked tar ball grabbed from
> > Rubyforge.
> >         Hugh
> >
> > :r! (cd /scratch/hgs; display_diffs.rb rubygems-0.9.4)
> >
> > --- rubygems-0.9.4/lib/rubygems/commands/sources_command.rb.orig	 
> > 2007-05-23 15:51:31.000000000 +0100
> > +++ rubygems-0.9.4/lib/rubygems/commands/sources_command.rb	 
> > 2007-08-29 18:15:20.674031000 +0100
> > @@ -18,7 +18,7 @@
> >            options[:remove] = value
> >          end
> >
> > -        add_option '-c', '--clear-all', 'Remove all sources' do | 
> > value, options|
> > +        add_option '-c', '--clear-all', 'Remove all sources (clear  
> > the cache)' do |value, options|
> >            options[:clear_all] = value
> >          end
> >        end
> 
> This part I like.  I also changed the description to:
> 
>    'Manage the sources and cache file RubyGems uses to search for gems'
> 

Thank you.
> > --- rubygems-0.9.4/lib/rubygems/commands/ 
> > clear_cache_command.rb.orig	2007-08-29 18:22:58.049867000 +0100
> > +++ rubygems-0.9.4/lib/rubygems/commands/clear_cache_command.rb	 
> > 2007-08-29 18:29:57.586782000 +0100
> > @@ -0,0 +1,37 @@
> > +module Gem
> > +  module Commands
> > +
> > +    class Clear_cacheCommand < Command
> > +
        [...]
> > +
> > +    end # class Clear_cacheCommand
> > +  end # module Commands
> > +end # module Gem
> 
> I don't understand this part.  How is this different from `gem  
> sources -c`?

I needed a way to put in a command name that reflected the semantics
of "clear the cache".  As far as I could see your commands are defined
separately, so I had to create a new class for it.  My intent was to 
allow more than one way to do this:  either
gem sources -c
or 
gem clear_cache
and this was the only way I could see to create this command.  Maybe
there's a better way I have missed to add that command.

In case you're wondering why anyone would need another command: I didn't
know till I poked around in this what was actually cached.  I didn't know
it was the sources as such.  So "clear the cache" which people mention
didn't lead me to look at the source command. Therefore I thought people
would look for a separate command.

        Thank you
        Hugh


More information about the Rubygems-developers mailing list