gem_plugin 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. data.tar.gz.sig +4 -0
  2. data/CHANGELOG +2 -0
  3. data/Manifest +15 -0
  4. data/gem_plugin.gemspec +53 -0
  5. data/resources/Rakefile +39 -15
  6. data/setup.rb +1360 -0
  7. metadata +79 -72
  8. metadata.gz.sig +0 -0
  9. data/Rakefile +0 -41
  10. data/doc/rdoc/classes/GemPlugin.html +0 -248
  11. data/doc/rdoc/classes/GemPlugin.src/M000001.html +0 -19
  12. data/doc/rdoc/classes/GemPlugin/Base.html +0 -194
  13. data/doc/rdoc/classes/GemPlugin/Base.src/M000002.html +0 -20
  14. data/doc/rdoc/classes/GemPlugin/Base.src/M000003.html +0 -18
  15. data/doc/rdoc/classes/GemPlugin/Base.src/M000004.html +0 -18
  16. data/doc/rdoc/classes/GemPlugin/Manager.html +0 -377
  17. data/doc/rdoc/classes/GemPlugin/Manager.src/M000005.html +0 -23
  18. data/doc/rdoc/classes/GemPlugin/Manager.src/M000006.html +0 -49
  19. data/doc/rdoc/classes/GemPlugin/Manager.src/M000007.html +0 -19
  20. data/doc/rdoc/classes/GemPlugin/Manager.src/M000008.html +0 -29
  21. data/doc/rdoc/classes/GemPlugin/Manager.src/M000009.html +0 -18
  22. data/doc/rdoc/classes/GemPlugin/Manager.src/M000010.html +0 -28
  23. data/doc/rdoc/classes/GemPlugin/Manager.src/M000011.html +0 -28
  24. data/doc/rdoc/classes/GemPlugin/PluginNotLoaded.html +0 -111
  25. data/doc/rdoc/created.rid +0 -1
  26. data/doc/rdoc/files/COPYING.html +0 -756
  27. data/doc/rdoc/files/LICENSE.html +0 -168
  28. data/doc/rdoc/files/README.html +0 -265
  29. data/doc/rdoc/files/lib/gem_plugin_rb.html +0 -109
  30. data/doc/rdoc/fr_class_index.html +0 -30
  31. data/doc/rdoc/fr_file_index.html +0 -30
  32. data/doc/rdoc/fr_method_index.html +0 -37
  33. data/doc/rdoc/index.html +0 -24
  34. data/doc/rdoc/rdoc-style.css +0 -208
  35. data/resources/tools/rakehelp.rb +0 -106
  36. data/tools/rakehelp.rb +0 -106
@@ -1,168 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>File: LICENSE</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="fileHeader">
50
- <h1>LICENSE</h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>Path:</strong></td>
54
- <td>LICENSE
55
- </td>
56
- </tr>
57
- <tr class="top-aligned-row">
58
- <td><strong>Last Update:</strong></td>
59
- <td>Fri Jun 30 13:10:48 -0700 2006</td>
60
- </tr>
61
- </table>
62
- </div>
63
- <!-- banner header -->
64
-
65
- <div id="bodyContent">
66
-
67
-
68
-
69
- <div id="contextContent">
70
-
71
- <div id="description">
72
- <p>
73
- <a href="../classes/GemPlugin.html">GemPlugin</a> is copyrighted free
74
- software by Zed A. Shaw &lt;zedshaw at zedshaw dot com&gt; You can
75
- redistribute it and/or modify it under either the terms of the GPL or the
76
- conditions below:
77
- </p>
78
- <ol>
79
- <li>You may make and give away verbatim copies of the source form of the
80
- software without restriction, provided that you duplicate all of the
81
- original copyright notices and associated disclaimers.
82
-
83
- </li>
84
- <li>You may modify your copy of the software in any way, provided that you do
85
- at least ONE of the following:
86
-
87
- <pre>
88
- a) place your modifications in the Public Domain or otherwise make them
89
- Freely Available, such as by posting said modifications to Usenet or an
90
- equivalent medium, or by allowing the author to include your
91
- modifications in the software.
92
-
93
- b) use the modified software only within your corporation or
94
- organization.
95
-
96
- c) rename any non-standard executables so the names do not conflict with
97
- standard executables, which must also be provided.
98
-
99
- d) make other distribution arrangements with the author.
100
- </pre>
101
- </li>
102
- <li>You may distribute the software in object code or executable form, provided
103
- that you do at least ONE of the following:
104
-
105
- <pre>
106
- a) distribute the executables and library files of the software,
107
- together with instructions (in the manual page or equivalent) on where
108
- to get the original distribution.
109
-
110
- b) accompany the distribution with the machine-readable source of the
111
- software.
112
-
113
- c) give non-standard executables non-standard names, with
114
- instructions on where to get the original software distribution.
115
-
116
- d) make other distribution arrangements with the author.
117
- </pre>
118
- </li>
119
- <li>You may modify and include the part of the software into any other software
120
- (possibly commercial). But some files in the distribution are not written
121
- by the author, so that they are not under this terms.
122
-
123
- </li>
124
- <li>The scripts and library files supplied as input to or produced as output
125
- from the software do not automatically fall under the copyright of the
126
- software, but belong to whomever generated them, and may be sold
127
- commercially, and may be aggregated with this software.
128
-
129
- </li>
130
- <li>THIS SOFTWARE IS PROVIDED &quot;AS IS&quot; AND WITHOUT ANY EXPRESS OR
131
- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES
132
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
133
-
134
- </li>
135
- </ol>
136
-
137
- </div>
138
-
139
-
140
- </div>
141
-
142
-
143
- </div>
144
-
145
-
146
- <!-- if includes -->
147
-
148
- <div id="section">
149
-
150
-
151
-
152
-
153
-
154
-
155
-
156
-
157
- <!-- if method_list -->
158
-
159
-
160
- </div>
161
-
162
-
163
- <div id="validator-badges">
164
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
165
- </div>
166
-
167
- </body>
168
- </html>
@@ -1,265 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>File: README</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="fileHeader">
50
- <h1>README</h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>Path:</strong></td>
54
- <td>README
55
- </td>
56
- </tr>
57
- <tr class="top-aligned-row">
58
- <td><strong>Last Update:</strong></td>
59
- <td>Fri Jun 30 12:43:01 -0700 2006</td>
60
- </tr>
61
- </table>
62
- </div>
63
- <!-- banner header -->
64
-
65
- <div id="bodyContent">
66
-
67
-
68
-
69
- <div id="contextContent">
70
-
71
- <div id="description">
72
- <h1><a href="../classes/GemPlugin.html">GemPlugin</a>: Gem Based Plugin System</h1>
73
- <p>
74
- <a href="../classes/GemPlugin.html">GemPlugin</a> is a system that lets
75
- your users install gems and lets you load them as additional features to
76
- use in your software. It originated from the Mongrel (<a
77
- href="http://mongrel.rubyforge.org">mongrel.rubyforge.org</a>) project but
78
- proved useful enough to break out into a separate project.
79
- </p>
80
- <p>
81
- <a href="../classes/GemPlugin.html">GemPlugin</a> works by listing the gems
82
- installed, and doing a require_gem on any that have the right dependencies.
83
- For example, if a gem depends on &quot;gem_plugin&quot; and
84
- &quot;mongrel&quot; then it&#8216;ll load as a Mongrel plugin. This makes
85
- it so that users of the plugins only need to gem install (and maybe config
86
- a bit), and plugin authors only need to make gems.
87
- </p>
88
- <h2>Implementers</h2>
89
- <p>
90
- To use <a href="../classes/GemPlugin.html">GemPlugin</a> in your system you
91
- only have to require &#8216;gem_plugin&#8217; and then use the
92
- GemPlugin::Manager.create, GemPlugin::Manager.load, and
93
- GemPlugin::Manager.available methods to work with them.
94
- </p>
95
- <ul>
96
- <li>GemPlugin::Manager.load &#8212; Takes a &quot;depend include/exclude
97
- map&quot; and loads plugins based on it.
98
-
99
- </li>
100
- <li>GemPlugin::Manager.create &#8212; Takes a URI style name and some options
101
- then creates one for you.
102
-
103
- </li>
104
- <li>GemPlugin::Manager.available &#8212; Lets you inspect and mess with the
105
- internal plugin registry.
106
-
107
- </li>
108
- </ul>
109
- <h3>Loading Plugins</h3>
110
- <p>
111
- As an example from Mongrel it&#8216;s necessary to load plugins that depend
112
- on rails after the Rails system is configured, but load other plugins right
113
- when Mongrel is ready. To do this we very first do:
114
- </p>
115
- <pre>
116
- GemPlugin::Manager.instance.load &quot;mongrel&quot; =&gt; GemPlugin::INCLUDE, &quot;rails&quot; =&gt; GemPlugin::EXCLUDE
117
- </pre>
118
- <p>
119
- Later, when it&#8216;s ready to load Rails plugins as well we do this:
120
- </p>
121
- <pre>
122
- GemPlugin::Manager.instance.load &quot;mongrel&quot; =&gt; GemPlugin::INCLUDE
123
- </pre>
124
- <p>
125
- This simply loads any plugins that remain and are ready for use in Rails.
126
- </p>
127
- <h3>Creating Plugins</h3>
128
- <p>
129
- Creating a plugin is cake:
130
- </p>
131
- <pre>
132
- plug = GemPlugin::Manager.instance.create(&quot;/commands/snazzy&quot;, &quot;something&quot; =&gt; &quot;yeah&quot;)
133
- </pre>
134
- <p>
135
- In this case we&#8216;re making the snazzy command and passing a couple
136
- fake options.
137
- </p>
138
- <h3>Finding Available Plugins</h3>
139
- <p>
140
- Finding plugins is also very easy, you just call
141
- GemPlugin::Manager.instance.available and you get a Hash that maps
142
- categories to name =&gt; class. For example, if I had the
143
- &quot;/commands/snazzy&quot; plugin registered above, then I&#8216;d get
144
- the following:
145
- </p>
146
- <pre>
147
- puts GemPlugin::Manager.instance.available[&quot;/commands&quot;].inspect
148
- -&gt; { &quot;/snazzy&quot; =&gt; Snazzy}
149
- </pre>
150
- <h3>Plugins Inside Modules</h3>
151
- <p>
152
- Plugins that are placed in modules are also lowercased when registered but
153
- still retain their module. So, if Snazzy was actually MyModule::Snazzy,
154
- then it&#8216;d be registered as &quot;/commands/mymodule::snazzy&quot;.
155
- </p>
156
- <h2>Plugin Authors</h2>
157
- <p>
158
- People who wish to write gem plugins have a faily easy time of it, but need
159
- to know the particular rules for the target system. To keep this example
160
- concrete we&#8216;ll assume you want to write a Mongrel command plugin.
161
- </p>
162
- <p>
163
- First thing is create your project like normal and setup Rake to make your
164
- gem. Your plugin then needs to be created like so:
165
- </p>
166
- <pre>
167
- class Snazzy &lt; GemPlugin::Plugin &quot;/commands&quot;
168
- ...
169
- end
170
- </pre>
171
- <p>
172
- And place this code in a file you will have RubyGems autorequire (I use
173
- lib/init.rb).
174
- </p>
175
- <p>
176
- Next you need to add the following to whatever Rakefile code you use to
177
- create your gem:
178
- </p>
179
- <pre>
180
- spec.add_dependency('gem_plugin', '&gt;= 0.1')
181
- spec.add_dependency('mongrel', '&gt;= 0.3.9')
182
- spec.autorequire = 'init.rb'
183
- </pre>
184
- <p>
185
- This does three things:
186
- </p>
187
- <ul>
188
- <li>Tells GemPlugins::Manager.load that this is a <a
189
- href="../classes/GemPlugin.html">GemPlugin</a>.
190
-
191
- </li>
192
- <li>Tells Mongrel that this is a Mongrel specific <a
193
- href="../classes/GemPlugin.html">GemPlugin</a>.
194
-
195
- </li>
196
- <li>Tells RubyGems to run init.rb when the gem is required, just hooking up
197
- your plugin.
198
-
199
- </li>
200
- </ul>
201
- <p>
202
- Now, all the users of your plugin have to do is gem install it and then
203
- they get the plugin automagically.
204
- </p>
205
- <p>
206
- People writing GemPlugins for other systems would have to check the
207
- documentation from that project to get an idea of what extra requirements
208
- might be needed. For example, you&#8216;d probably have to depend on
209
- another project other that <b>mongrel</b> and most likely have a few more
210
- things to configure in your init.rb.
211
- </p>
212
- <h2>Plugin Users</h2>
213
- <p>
214
- Plugin users have it the easiest of all. They simply do:
215
- </p>
216
- <pre>
217
- gem install mongrel_command_snazzy
218
- </pre>
219
- <p>
220
- And that&#8216;s it. When they run mongrel_rails (given the above example)
221
- this snazzy command get loaded automatically without any intervention.
222
- </p>
223
- <p>
224
- The only thing missing in this release is a way for end users to configure
225
- such a plugin. I really think this is the job of the implementers to
226
- define.
227
- </p>
228
- <h2>Contact</h2>
229
- <p>
230
- E-mail zedshaw at zedshaw.com and I&#8216;ll help. Comments about the API
231
- are welcome.
232
- </p>
233
-
234
- </div>
235
-
236
-
237
- </div>
238
-
239
-
240
- </div>
241
-
242
-
243
- <!-- if includes -->
244
-
245
- <div id="section">
246
-
247
-
248
-
249
-
250
-
251
-
252
-
253
-
254
- <!-- if method_list -->
255
-
256
-
257
- </div>
258
-
259
-
260
- <div id="validator-badges">
261
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
262
- </div>
263
-
264
- </body>
265
- </html>
@@ -1,109 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>File: gem_plugin.rb</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="fileHeader">
50
- <h1>gem_plugin.rb</h1>
51
- <table class="header-table">
52
- <tr class="top-aligned-row">
53
- <td><strong>Path:</strong></td>
54
- <td>lib/gem_plugin.rb
55
- </td>
56
- </tr>
57
- <tr class="top-aligned-row">
58
- <td><strong>Last Update:</strong></td>
59
- <td>Sun Sep 03 12:52:42 -0700 2006</td>
60
- </tr>
61
- </table>
62
- </div>
63
- <!-- banner header -->
64
-
65
- <div id="bodyContent">
66
-
67
-
68
-
69
- <div id="contextContent">
70
-
71
-
72
- <div id="requires-list">
73
- <h3 class="section-bar">Required files</h3>
74
-
75
- <div class="name-list">
76
- singleton&nbsp;&nbsp;
77
- rubygems&nbsp;&nbsp;
78
- </div>
79
- </div>
80
-
81
- </div>
82
-
83
-
84
- </div>
85
-
86
-
87
- <!-- if includes -->
88
-
89
- <div id="section">
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
- <!-- if method_list -->
99
-
100
-
101
- </div>
102
-
103
-
104
- <div id="validator-badges">
105
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
106
- </div>
107
-
108
- </body>
109
- </html>