On Jul 9, 2010, at 09:25, Luis Lavena wrote:
>> A solution for command plugins would be to have plugins simply register a 
>> list of files that should be loaded when commands are going to be invoked. A 
>> continuation of this idea leads to an API something along the lines of:
>> 
>> Gem.register_plugin(:install, 'some_plugin/gem/installer')
>> Gem.register_plugin(:command, 'some_plugin/gem/command')
>> 
> 
> Wouldn't be more appropriate Gem.register_command(:push,
> 'path/to/gemcutter/plugin') ?
> 
> After all, you're registering commands, since the plugin loader has
> already been started.

I think register_plugin could be as simple as:

module Gem

  @plugins = Hash.new { |h,k| h[k] = [] }

  def self.register_plugin type, path
    @plugins[type] << path
  end
end

And Gem::CommandManager would look in the hash to see what files it should load 
after it is required (if at all).
_______________________________________________
Rubygems-developers mailing list
http://rubyforge.org/projects/rubygems
Rubygems-developers@rubyforge.org
http://rubyforge.org/mailman/listinfo/rubygems-developers

Reply via email to