UPDATE: I ended up making some pretty massive changes. You can configure multiple plugin repositories, install, update, remove, and discover plugins. The directions for installation are still valid but you’ll need to run
plugin --help to get a feel for the changes in usage.
UPDATE: The plugin manager has been included with Rails 1.0 RC4.
script/plugin --help from a fresh Rails app for usage information.
Rails 1.0 RC1 shipped with a simple plugin system - drop a directory under
vendor/plugins that contains an
init.rb file to be executed at configuration time and an optional
lib directory to be placed on the path. Do whatever you please from there. It’s a simple hook into the startup cycle and a much needed addition.
About 19 hours ago, David suggested that people link to their plugins from the Rails Wiki as a kind of interim solution to the problem of not having a standard means of packaging and managing these things. They did and with links to their plugins’ subversion repositories.
Here’s a simple (150 line) plugin manager.
Install it like this:
$ cd my-rails-app
$ curl http://lesscode.org/svn/rtomayko/rails/scripts/plugin > script/plugin
$ chmod +x script/plugin
Then see what plugins are available:
Next, install stuff to your
$ ./script/plugin continuous_builder asset_timestamping
Here’s how it works:
Scrape the Plugin page for things that look like subversion repositories with plugins. (Yes, I’m using regular expressions. Yes, I understand the issues. No, I don’t care.)
vendor/plugins is under subversion control, the script will modify the
svn:externals property on that directory and perform an update. You can use normal subversion commands to keep the plugins up to date.
vendor/plugins is not under subversion control, the plugin is pulled via
If you want to use
svn:externals, make sure you have your
vendor/plugins directory under subversion’s control before installing any plugins . If your not sure, do something like this:
$ svn info vendor/plugins
foo: (Not a versioned resource)
$ svn mkdir vendor/plugins
$ svn ci -m "adding teh plugins directory so I can use this r0x3ring plugin manager..."
This probably won’t work on Windows at the moment and assumes you have the command line subversion client utilities available (
It’s useful as is, but please, make it better.