Installing Plug-ins

Problem

You want to install a plug-in, adding functionality to your application. You also want to know how to remove plug-ins that you've installed.

Solution

Install a plug-in by passing the name of the plug-in to the install command of the plugin script. The following installs the sparklines plug-in locally:

rob@mac:~/webapp$ ruby script/plugin install sparklines
+ ./sparklines/MIT-LICENSE
+ ./sparklines/README
+ ./sparklines/Rakefile
+ ./sparklines/generators/sparklines/sparklines_generator.rb
+ ./sparklines/generators/sparklines/templates/controller.rb
+ ./sparklines/generators/sparklines/templates/functional_test.rb
+ ./sparklines/init.rb
+ ./sparklines/lib/sparklines.rb
+ ./sparklines/lib/sparklines_helper.rb

Plug-ins are installed as directories in vender/plugins:

rob@mac:~/webapp$ ls vendor/plugins/sparklines/
MIT-LICENSE README Rakefile generators/ init.rb lib/

Un-install a plug-in with the remove command of the plugin script, passing it one or more plug-in names:

rob@mac:~/webapp$ ruby script/plugin remove sparklines 

Discussion

The plugin script inspects your environment and looks for evidence of your vender/plugins directory being user Subversion. If it is, the install command sets a svn:externals property on the directory of each plug-in you install, allowing you to use normal Subversion commands to keep the plug-in(s) up to date.

If your vender/plugins isn't under Subversion control, plug-ins can be installed using the svn co command.

The --help option of install lists the following options, which allow you to explicitly specify install methods, specific plug-in revision numbers, and forced reinstallations of plug-ins:


-x, --externals

Use svn:externals to grab the plug-in. Enables plug-in updates and plug-in versioning.


-o, --checkout

Use svn checkout to grab the plug-in. Enables updating but does not add a svn:externals enTRy.


-q, --quiet

Suppresses the output from installation. Ignored if -v is passed (e.g., ./script/plugin -v install).


-r, --revision
REVISION

Checks out the given revision from Subversion. Ignored if Subversion is not used.


-f, --force

Reinstalls a plug-in if it's already installed.

See Also