← Home

Engines for Rails 2.0 preview released

Grab the plugin here: http://svn.rails-engines.org/engines/trunk

In order to work with the new plugin loading mechanism in Rails 2.0, you'll also need to add a line to environment.rb, just after the require of Rails' boot file:

require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')

After that, you're good to go. Kick the tires, take it for a spin around the block, and please do let me know how it runs. There may be problems, we'll try and resolve them as you guys report them back.

(Update: I've just seen that there's also an announcement on the Rails Engines blog which explains some additional details.)

My initial port amended Engines to use the new plugin architecture that Rails 2.0 now implements and it already covered probably 80% of the features of Engines. I also ported and revisited the test cases which by now run with 91 assertations in 49 tests.

James generously granted me commit access for the Engines repository and took care of some of the more challenging features (like fixing the ActionMailer integration) and factored out the entire ActionView part.

Working with James was a great joy and it's pretty cool to know that Engines is lead by a both rational and nice guy like him.

With now relying on Rails' own architecture for locating and loading plugins Engines' own code has slimmed down by a large part. It's quite telling to look at the SLOC of various Rails Engines releases:

Rails Engines rel_1.1.0
---------------------------------------------
Files      SLOC      CLOC      BLOC      TLOC
   17      1104       506       273      1883

Rails Engines rel_1.2.1
---------------------------------------------
Files      SLOC      CLOC      BLOC      TLOC
   18       633       950       180      1763

Rails Engines for Rails 2.0 (current trunk)
---------------------------------------------
Files      SLOC      CLOC      BLOC      TLOC
   18       481       680       105      1266

As you can see, Rails Engines is down to 50% of the SLOC of the 1.1.0 release and removed another 25% from the 1.2.1 release ... and that even still includes some general purpose support like sharing assets and testing plugins.

So, I think this is great news!

Rails Engines supplies the need to share controllers, models, views and stuff like routes and assets in a standarized way. It does this in the most reasonable and unobstrusive way I could think of by using the great new plugin architecture features that Rails 2.0 implements.