One sentence summary: "Everything is a gem, most things work from within the gem, and all dependencies are accounted for."
How are Plugems different from...
- Plugems are a superset of Rails plugins.
- Plugems are bundled as Rubygems and are installed on the server hosting your application. Plugins are directories of files that get copied into the vendor/plugins directory of every application that leverages them.
- Plugins aren't dependency-managed. If one plugin depends upon another, then you have to handle the dependencies in a very implicit way. Plugems supports full dependency management: applications declare dependencies, dependencies declare their own subdependencies. Plugin load-path hacks aren't enough because they fail to address the issue of 'behavioral dependencies' (i.e. one plugin's init needing run after another.)
- Thanks to Rubygems, Plugems supports revision/release conventions. It was important for us to version dependencies explicitly or implicitly. Now you have full control.
- Plugems can be distributed through the standard Rubyforge repository (but they're still backwards compatible with plugin install.)
- Plugems adds support for the loading of views from gems (in addition to rake tasks, models, etc.)
- With plugins, you can't update a plugin for all apps on a box without pushing the applications. With Plugems, you simply install the new gem and bounce the apps. All applications that are not hard-locked to a particular revision of that plugem will pick up the latest version automatically.
- Engines have no support for dependency management or revision/release conventions (see #2, #3 for plugins.)
- With Engines, you can't update an engine for all apps on a box without pushing new application code. (see plugins #7)
- The Plugems library is distributed as a ruby gem -- no plugin or svn external to maintain. Simply update your gem when you're ready to take a new version.
- Plugems intentionally don't support migrations -- It was a fundamental choice we made early on to avoid the temptation to build apps that share databases (resulting in highly-coupled applications with the database as the integration point.)
- Plugems intentionally don't support runtime asset loading. We believe the coalescence of assets is a deployment-time issue (plugem deployment is forthcoming in this series.) For local development, something like this is needed, though. We use a mongrel handler for local development.
- Plugems intentionally don't support to routes. We decided that applications own urls, not shared libraries.
Recent related core discussion
- This patch does not account for rake tasks, views, etc. from within plugin gems (albeit probably intentionally for consistency with plugins.)
- With the latest patch, gems are bundled with the application, preventing live-uptake of new versions (see Engines #5)
Other notable features
- Plugems is accompanied by a tool for examining, updating, building, and 'deploying' plugems to other developers on the team (or developers on other teams that share your plugem.). Think `svn up; plugem up`. These capabilities leverage the existing Rubygems platform. We're still busy preparing these for release--this release is only the runtime environment.
- Support for applications-as-gems (more useful with the release of the deployment-time tools.)
- You can develop a plugem without loosing its dependency knowledge. You can check out or symlink the plugem into your plugins directory for active development and Plugems will ignore the installed gem but still load that 'bypassed' Plugem's dependencies.
Install it on your box:
As a gem:
gem install plugems
Create your plugem configuration:
Add config/manifest.yml describing your plugem and its dependencies:
:"My First Plugemified Application"
: - ['some_gem', '~> 1.0']
- ['other_gem', '> 2.0']
- ['one_more', '2.0.1']
Bootstrap the plugems:
Add the plugems requirement to config/boot.rb at the bottom right before the initializer call:
# Add this line:
require_gem 'plugems', '~> 1.0'
You are all set to enjoy the power of plugems!
Plugems released under the MIT license.
The plugin RubyForge page is http://rubyforge.org/projects/plugems
We've been using this internally for quite a few months, and are really interested in feedback from the community. Please tell us what you think!