With all the talk of 1.1, and with all the patches being applied, I
realized that my laziness (or lack of free time, depending on your
perspective) means that my OpenBase database adapter will most likely
not make it into 1.1. This is mainly because I never got around to
making it a plugin so that it could be throughly tested by the
OpenBase community before being committed. Well, I'm finally
motivated...
In looking into what constitutes a plugin, I felt even more lazy and
stupid. All i needed to do was put my openbase_adapter.rb into a
vendor/plugins/openbase/lib folder. A single line init.rb file to
require the adapter and voila! Instant OpenBase! Ruby truly is a
beautiful language. The whole process brought a tear to my eye.
But then...Disaster! Still no adapter! Not wanting to admit defeat,
nor to bother the core list with a trivial question during the big
1.1 push, I delved further into the core than I had before. And
gentlemen, might I congratulate you on a rather beautiful code base.
Very clean. In just a few minutes I had tracked it down. The
initializer attempts to initialize_database before it attempts to
load_plugins. Of course, without a database adapter the initializer
ultimately raises an AdapterNotFound error and exits without ever
loading my lovely new plugin.
I said to myself, "Self, you need to get your plugin loaded
earlier". And there it was...the environment. I added a single line
to environment.rb, just above the call to Rails::Initializer.run:
Rails::Initializer.run(:load_plugins)
Woohoo! OpenBase has been found!
But now it seems that I've violated the very spirit of the plugin. A
plugin shouldn't require a developer to do anything more than drop
the plugin into the vendor/plugins directory, right? With my limited
exposure to the core, I knew no other answer. Realizing that I'm
going to fail my compilers course if I don't get back to doing my
homework, I decided I would ask the experts.
Gentlemen (and ladies, perhaps?), what could I have done better?
-Derrick Spell
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core