-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
60 lines (35 loc) · 1.82 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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