Prev | Current Page 117 | Next

Brad Ediger

"Advanced Rails"


The actual plugin locating and loading system is extensible, and you can write your
own strategies. The locator (which by default is Rails::Plugin::FileSystemLocator)
searches for plugins; the loader (by default Rails::Plugin::Loader) determines
whether a directory contains a plugin and does the work of loading it.
To write your own locators and loaders, examine railties/lib/rails/plugin/locator.rb
and railties/lib/rails/plugin/loader.rb. The locators (more than one locator can be
used) and loader can be changed with configuration directives:
config.plugin_locators += [MyPluginLocator]
config.plugin_loader = MyPluginLoader
Installing Rails Plugins
Plugins are most often installed with the built-in Rails plugin tool, script/plugin.
This plugin tool has several commands:
discover/source/unsource/sources
The plugin tool uses an ad-hoc method of finding plugins. Rather than requiring
you to specify the URL of a plugin repository, script/plugin tries to find it for you.
One way it does this is by scraping the ???Plugins??? page of the Rails wiki* for
source URLs. This can be triggered with the discover command.
The source and unsource commands add and remove source URLs, respectively.
The sources command lists all current source URLs.
install/update/remove
These commands install, update, and uninstall plugins. They can take an HTTP
URL, a Subversion URL (svn:// or svn+ssh://), or a bare plugin name, in which
case the list of sources is scanned.


Pages:
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129