Skip to content

Extends the plugin class to teminate the aplication if the given plugins can't be found.

License

Notifications You must be signed in to change notification settings

neilchandler/plugin_requirements

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PluginRequirements
==============

Extends the plugin class to include a requirements method. You can then 
specify what plugins or gems are used by the plugin you are developing and 
prevent the application from starting up if the required resource can't be 
found.


Example
=======

install the plugin 

    script/plugin install git://github.com/neilchandler/plugin_requirements.git
    
modify your environment.rb file so that plugin_requirements plugin is loaded 
before all other plugins.

    config.plugins = [ :plugin_requirements, :all ]
    
Generate a couple of test plugin skeleton

    script/generate plugin my_first_plugin
    script/generate plugin my_second_plugin
    
In the plugin file my_first_plugin/init.rb add a plugin requirement

    requirements :foo
    
Unless you actually have a plugin called foo the application will fail to 
start with the following error message:

    Required plugin missing: [my_first_plugin] requires [vendor/plugins/foo]

Multiple plugins can be specified too

    requirements :foo, :bar

resulting in multiple error messages being generated, if neither plugin is found.

    Required plugin missing: [my_first_plugin] requires [vendor/plugins/foo]
    Required plugin missing: [my_first_plugin] requires [vendor/plugins/bar]
    
The requirements for all plugins are checked before the application is stopped.
Add a plugin requirement to my_second_plugin/init.rb

    requirements :wibble
    
resulting in both original errors from my_first_plugin as well as the new 
error from my_second_plugin

    Required plugin missing: [my_first_plugin] requires [vendor/plugins/foo]
    Required plugin missing: [my_first_plugin] requires [vendor/plugins/bar]
    Required plugin missing: [my_second_plugin] requires [vendor/plugins/wibble]




Copyright (c) 2009 Neil Chandler, released under the MIT license

About

Extends the plugin class to teminate the aplication if the given plugins can't be found.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages