Plugin is a straightforward plugin manager for Ruby. It can handle RubyGems, Rolls and Ruby’s standard site locals. It is both more flexible and more robust the using Gem.find_files or searching the $LOAD_PATH manually.
The Plugin library does two significant things. First it designates a location in the ruby $LOAD_PATH for plugins. Second it provides an easy to use function for finding plugin scripts stored in the designated location.
Place all plugins for your project in lib/plugins/<name>/. Or if you have altered the load path for your project, you can place them in the alternate location, <alternate-loadpath>/plugins/<name>/. (Note: Altering the conventional load path should be avoided whenever possible.)
To find plugins, simply provide a glob to the Plugin.find function, and it will return all matches found within current and/or most recent versions of libraries.
For example, a common use case for a pluggable application is to require all the plugins found:
require 'plugin' Plugin.find('myapp/*.rb').each do |file| require(file) end
Rather then load all plugins you might load plugins only as needed. For instance, if a command-line option selects for a special template.
Copyright © 2009 Thomas Sawyer
Plugin is release under the terms of the LGPL.
Plugin is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
Plugin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with Plugin. If not, see
See COPYING file for more details.