On 3/6/06, Zed Shaw <zedshaw / zedshaw.com> wrote:
Hey, Zed. this looks pretty interesting. Just a few points that I thinkwill require a pretty quick rework:
> == Quick Usage>> Plugin Authors do this:>>  class Snazzy < GemPlugin::Plugin "/commands">     ...>  end>> Then place this code in a file they will have RubyGems autorequire (I> use lib/init.rb).
> Next they need to add the following to whatever Rakefile code you use to> create your gem:>>  spec.add_dependency('gem_plugin', '>= 0.1')>  spec.add_dependency('theapp', '>= 0.1')>  spec.autorequire = 'init.rb'
The #autorequire is deprecated at this point and is not recommended inany way. RubyGems still supports it, but I believe that the next versionwill be spouting some warnings at people who use autorequire in buildingtheir gems. Since you're using a secondary call to do the load, you canmandate that lib/init.rb is the file to load and have your loader do therequire yourself.
> System Implementers then setup their system to do this:>>  GemPlugin::Manager.instance.load "theapp" => GemPlugin::INCLUDE>  plug = GemPlugin::Manager.instance.create("/commands/snazzy")
This also seems like you're using Singleton. I think you should be ableto do this such that you can drop the call to Manager.instance if youput your load/create etc. as transparent reflections to an instance. I'mnot sure that I did it in the most optimal way in MIME::Types 1.15 thatI released recently, but I had changed MIME::Types from a module to aclass and implemented it such that it was more or less transparent tothe user. You should be able to do it with:
  class GemPlugin::Manager    class << self      private :new
      def method_missing(m, *a, &b)        @__me__ ||= self.new        @__me__.__send__(m, *a, &b)      end    end  end
Then it would simply become:
  GemPlugin::Manager.load "theapp" => GemPlugin::INCLUDE  plug = GemPlugin::Manager.create("/commands/snazzy")
-austin--Austin Ziegler * halostatue / gmail.com               * Alternate: austin / halostatue.ca