[Rubygems-developers] faster rubygems.rb loading by way of deferred plugin loads, and other resource usage enhancements

James Tucker jftucker at gmail.com
Fri Jul 9 22:15:22 EDT 2010


On 10 Jul 2010, at 00:39, Eric Hodel wrote:

> 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).

Yup, that's exactly what i was going toward.

> _______________________________________________
> Rubygems-developers mailing list
> http://rubyforge.org/projects/rubygems
> Rubygems-developers at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rubygems-developers



More information about the Rubygems-developers mailing list