A step forward
Submitted by MohsinHijazee on Wed, 08/06/2008 - 13:16
We were looking at the engines plugin for a while and despite all the flame wars around it, Me and Raphael were somewhat convinced that it would be needed somehow in future.
I kept trying installing it but failed. So a little context here, we ported our application from Rails 1.2 to Rails 2.02. And it was this version which we "freezed" under the vendor directory. And installing engines plugin on that version was failing.
From my past development experiences, and from observing some colleagues for a while in my career, I've a nature of being very lean and mean about things. If something simpler gets the job done, I'll not think about intellectually appealing solutions even if they offer more. So this nature kept me from trying to install engines plugin as though it was needed but it was not blocking our way so far. So in my view, I kept making progress on other things.
For last two days, I was working to make it possible to extend with more data types then available by default. For this, we had a vision of using plugins. I again thought about engines plugin and failed. As I said earlier, it was not blocking so I moved on. But this evening, Raphael was working with engines and he told me that he has them up and running! I was really happy to know this as this meant a whole lot new range of possibilities!
So here I'll outline the steps that Raphael did in order to install the rails plugin:
First of all, Its better that you move to Rails 2.1.0 and not only that, also freeze your application to this version.
You need to install rails if its not already the case:
$ gem install rails # So that you have latest version installed.
Next from root of your application, You need to unfreeze your previous version of rails if any:
$ rake rails:unfreeze # Remove previously frozen version if any.
Next you need to freeze the version of rails from your gems into your application:
$ rake rails:freeze:gems # Will freeze rails application under vendor/rails
Also, you need to update the scripts of rails. This is needed because this updates the plugin script which in turn enables you to install plugins from git repositories. And its somewhat mandatory to do this for installing engines plugin!
$ rake rails:update:scripts # Would update scripts
So far you are done with updating rails and freezing it under vendor/rails. I'd recommend that you run your tests rigorously after this to be sure everything is fine.
So next step is that of installing engines plugin. So that's simple:
$ ruby script/plugin install git://github.com/lazyatom/engines.git
Next you need to alter your config/environment.rb a little bit so that engines plugin is able to modify the core of Rails. For that, Add following line just before the require statement of Rails itsef:
require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')
And you are good to go! I'd say again run the tests to check if all working well. And if so, Congratulations!
I promised to write about Globalite further, short on schedule, so that's for some other time!