Snowblink
APR 06
05

Installing Rails Engines

Rails Engines are a way to distribute a feature you intend to use in several of your Rails applications.

There are a number of ways to get engines to work in with your application. I will use login_engine in this example, but the principle applies to all engines, including your own.

script/plugin install

Engines are just plugins and can be installed the same way as other plugins.

script/plugin source http://svn.rails-engines.org/plugins
script/plugin install engines
script/plugin install login_engine

This will work and you will get the latest releases of engines and the login_engine.

If you want to update your plugins:

script/plugin update

Now if you're using subversion (you are using subversion right?), you probably won't use the script/plugin install as you would have to update your repository each time you updated your plugins.

More likely, you will use one of the next methods.

script/plugin install -x

You can have the plugin script setup the svn:externals for you:

script/plugin install -x engines
script/plugin install -x login_engine

You can see the svn:externals that have been created:

svn propget svn:externals vendor/plugins
login_engine  http://svn.rails-engines.org/plugins//login_engine
engines  http://svn.rails-engines.org/plugins//engines

Whenever you checkout your application, it will go and fetch the latest stable version of your engines. This is all well and good, but you may encounter problems if you are using a newer version of an engine than you had tested with.

svn:externals

To have more control over what you are using, then use svn:externals yourself.

svn propedit svn:externals

While developing track the release branch:

engines  http://svn.rails-engines.org/engines/branches/rb_1.1
login_engine  http://svn.rails-engines.org/login_engine/branches/rb_1.0

When you are ready to release your application, then settle on the latest release tag for the branch you were working on:

engines  http://svn.rails-engines.org/engines/tags/rel_1.1.0
login_engine  http://svn.rails-engines.org/login_engine/tags/rel_1.0.0

This method is the one I use and recommend. Depending on what you are trying to achieve you can choose any of the above. It is not too difficult to switch from one way of doing things to another.

Tagged As