On Mon, Mar 06, 2006 at 10:20:38PM +0900, Austin Ziegler wrote: > On 3/6/06, Zed Shaw <zedshaw / zedshaw.com> wrote: > > Hey, Zed. this looks pretty interesting. Just a few points that I think > will require a pretty quick rework: > <snip> > The #autorequire is deprecated at this point and is not recommended in > any way. RubyGems still supports it, but I believe that the next version > will be spouting some warnings at people who use autorequire in building > their gems. Since you're using a secondary call to do the load, you can > mandate that lib/init.rb is the file to load and have your loader do the > require yourself. > Man that just sucks. I'll have to think about this, but off the top of my head doing a require of init.rb won't work. I'll have to __FILE__ crap and re-implement the autorequire code. Maybe I can chat with the rubygems folks and get it put back in. It really makes these plugins work perfectly with minimal effort. > > 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 able > to do this such that you can drop the call to Manager.instance if you > put your load/create etc. as transparent reflections to an instance. I'm > not sure that I did it in the most optimal way in MIME::Types 1.15 that > I released recently, but I had changed MIME::Types from a module to a > class and implemented it such that it was more or less transparent to > the 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 > I'll play with this, I agree that the instance stuff is really annoying. I also don't like the include/exclude stuff and will probably change that out for something more succinct. Zed A. Shaw http://www.zedshaw.com/