Plugins seem to be the way that a lot of the interesting work in Rails
is being done at the moment. Plugins are certainly very powerful, but
the way they’re installed could use some improvement. You can use
“script/plugin”, which does a screen-scrape of
http://wiki.rubyonrails.org/rails/pages/Plugins then uses Subversion to
install the plugin. But increasingly plugins are being written that
depend on other plugins, which in turn depend on others etc., and this
installation method doesn’t scale up very well at all.
Compare with package installation in systems such as Debian Linux,
where you just specify the package you want then dpkg handles the
details of downloading and installing the package and all its
dependencies, including updates where required. Wouldn’t it be nice if
installing plugins in Rails were like this?
I think this is achievable, using a combination of generators and gems.
The system could be arranged as follows:
The plugins are arranged as generators, with manifests and template
These generators are packaged and distributed as gems.
They still get used as plugins in a developer’s Rails project. The
difference is that the
gems take care of the installation (NOT the runtime) dependencies, and
generators put the files into vendor/plugins/ in the developer’s
After running the generator to put the plugin into a Rails project, the
developer could then run a Rake task to complete the installation. The
name of the task could be “<plugin_name>:install”. This would execute
the plugin’s “install.rb” file, generate any dependant plugins and
recursively run their :install tasks to get them set up too.
In summary the whole process might look something like this:
gem install someplugin_generator cd myproject script/generate someplugin rake someplugin:install
This would install the “someplugin” plugin – along with any number of
dependencies – setting them all up in “myproject”.
My idea would be to start a project that provides generator gems for
lots of useful and popular plugins that are already around at the
moment. It would involve taking the authors’ original code,
re-arranging the files a bit for installation as generators, writing
the generator manifest and the gem specification files for each,
gemming them up, and releasing them as gems on RubyForge with credits
and copyright remaining with the original author.
Does this project interest anyone? Anyone got any better ideas? Want