gem_plugin 0.2 → 0.2.1
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.
- data/Rakefile +1 -1
- data/doc/rdoc/classes/GemPlugin.src/M000001.html +5 -5
- data/doc/rdoc/classes/GemPlugin/Base.src/M000002.html +6 -6
- data/doc/rdoc/classes/GemPlugin/Base.src/M000003.html +4 -4
- data/doc/rdoc/classes/GemPlugin/Base.src/M000004.html +4 -4
- data/doc/rdoc/classes/GemPlugin/Manager.html +11 -5
- data/doc/rdoc/classes/GemPlugin/Manager.src/M000006.html +31 -30
- data/doc/rdoc/classes/GemPlugin/Manager.src/M000007.html +5 -5
- data/doc/rdoc/classes/GemPlugin/Manager.src/M000008.html +15 -15
- data/doc/rdoc/classes/GemPlugin/Manager.src/M000009.html +4 -4
- data/doc/rdoc/classes/GemPlugin/Manager.src/M000010.html +14 -14
- data/doc/rdoc/classes/GemPlugin/Manager.src/M000011.html +14 -14
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/lib/gem_plugin_rb.html +1 -1
- data/lib/gem_plugin.rb +11 -4
- data/tools/rakehelp.rb +2 -1
- metadata +2 -2
data/Rakefile
CHANGED
@@ -10,10 +10,10 @@
|
|
10
10
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/gem_plugin.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/gem_plugin.rb, line 278</span>
|
14
|
+
278: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">GemPlugin</span><span class="ruby-operator">::</span><span class="ruby-constant">Plugin</span>(<span class="ruby-identifier">c</span>)
|
15
|
+
279: <span class="ruby-constant">Base</span>.<span class="ruby-identifier">category</span> = <span class="ruby-identifier">c</span>
|
16
|
+
280: <span class="ruby-constant">Base</span>
|
17
|
+
281: <span class="ruby-keyword kw">end</span></pre>
|
18
18
|
</body>
|
19
19
|
</html>
|
@@ -10,11 +10,11 @@
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/gem_plugin.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/gem_plugin.rb, line 249</span>
|
14
|
+
249: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Base</span>.<span class="ruby-identifier">inherited</span>(<span class="ruby-identifier">klass</span>)
|
15
|
+
250: <span class="ruby-identifier">name</span> = <span class="ruby-value str">"/"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">downcase</span>
|
16
|
+
251: <span class="ruby-constant">Manager</span>.<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">register</span>(<span class="ruby-ivar">@@category</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">klass</span>)
|
17
|
+
252: <span class="ruby-ivar">@@category</span> = <span class="ruby-keyword kw">nil</span>
|
18
|
+
253: <span class="ruby-keyword kw">end</span></pre>
|
19
19
|
</body>
|
20
20
|
</html>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/gem_plugin.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/gem_plugin.rb, line 256</span>
|
14
|
+
256: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Base</span>.<span class="ruby-identifier">category=</span>(<span class="ruby-identifier">category</span>)
|
15
|
+
257: <span class="ruby-ivar">@@category</span> = <span class="ruby-identifier">category</span>
|
16
|
+
258: <span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/gem_plugin.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/gem_plugin.rb, line 260</span>
|
14
|
+
260: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span> = {})
|
15
|
+
261: <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
|
16
|
+
262: <span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|
@@ -258,14 +258,20 @@ Which will load all plugins that depend on mongrel AND gem_plugin. Now, one
|
|
258
258
|
extra thing we do is we delay loading Rails Mongrel plugins until after
|
259
259
|
rails is configured. Do do this the mongrel_rails script has:
|
260
260
|
</p>
|
261
|
-
<pre>
|
262
|
-
GemPlugin::Manager.instance.load "mongrel" => GemPlugin::INCLUDE, "rails" => GemPlugin::EXCLUDE
|
263
|
-
</pre>
|
264
261
|
<p>
|
265
|
-
|
266
|
-
|
262
|
+
GemPlugin::Manager.instance.load "mongrel" =>
|
263
|
+
GemPlugin::INCLUDE, "rails" => GemPlugin::EXCLUDE The only
|
264
|
+
thing to remember is that this is saying "include a plugin if it
|
265
|
+
depends on gem_plugin, mongrel, but NOT rails". If a plugin also
|
267
266
|
depends on other stuff then it’s loaded just fine. Only gem_plugin,
|
268
267
|
mongrel, and rails are ever used to determine if it should be included.
|
268
|
+
</p>
|
269
|
+
<p>
|
270
|
+
NOTE: Currently RubyGems will run autorequire on gems that get required AND
|
271
|
+
on their dependencies. This really messes with people running edge rails
|
272
|
+
since activerecord or other stuff gets loaded for just touching a gem
|
273
|
+
plugin. To prevent this load requires the full path to the
|
274
|
+
"init.rb" file, which avoids the RubyGems autorequire magic.
|
269
275
|
</p>
|
270
276
|
</div>
|
271
277
|
</div>
|
@@ -10,35 +10,36 @@
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/gem_plugin.rb, line
|
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
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/gem_plugin.rb, line 107</span>
|
14
|
+
107: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load</span>(<span class="ruby-identifier">needs</span> = {})
|
15
|
+
108: <span class="ruby-identifier">sdir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">Gem</span>.<span class="ruby-identifier">dir</span>, <span class="ruby-value str">"specifications"</span>)
|
16
|
+
109: <span class="ruby-identifier">gems</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">SourceIndex</span>.<span class="ruby-identifier">from_installed_gems</span>(<span class="ruby-identifier">sdir</span>)
|
17
|
+
110: <span class="ruby-identifier">needs</span> = <span class="ruby-identifier">needs</span>.<span class="ruby-identifier">merge</span>({<span class="ruby-value str">"gem_plugin"</span> =<span class="ruby-operator">></span> <span class="ruby-constant">INCLUDE</span>})
|
18
|
+
111:
|
19
|
+
112: <span class="ruby-identifier">gems</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">path</span>, <span class="ruby-identifier">gem</span><span class="ruby-operator">|</span>
|
20
|
+
113: <span class="ruby-comment cmt"># don't load gems more than once</span>
|
21
|
+
114: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gems</span>.<span class="ruby-identifier">has_key?</span> <span class="ruby-identifier">gem</span>.<span class="ruby-identifier">name</span>
|
22
|
+
115: <span class="ruby-identifier">check</span> = <span class="ruby-identifier">needs</span>.<span class="ruby-identifier">dup</span>
|
23
|
+
116:
|
24
|
+
117: <span class="ruby-comment cmt"># rolls through the depends and inverts anything it finds</span>
|
25
|
+
118: <span class="ruby-identifier">gem</span>.<span class="ruby-identifier">dependencies</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">dep</span><span class="ruby-operator">|</span>
|
26
|
+
119: <span class="ruby-comment cmt"># this will fail if a gem is depended more than once</span>
|
27
|
+
120: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">check</span>.<span class="ruby-identifier">has_key?</span> <span class="ruby-identifier">dep</span>.<span class="ruby-identifier">name</span>
|
28
|
+
121: <span class="ruby-identifier">check</span>[<span class="ruby-identifier">dep</span>.<span class="ruby-identifier">name</span>] = <span class="ruby-operator">!</span><span class="ruby-identifier">check</span>[<span class="ruby-identifier">dep</span>.<span class="ruby-identifier">name</span>]
|
29
|
+
122: <span class="ruby-keyword kw">end</span>
|
30
|
+
123: <span class="ruby-keyword kw">end</span>
|
31
|
+
124:
|
32
|
+
125: <span class="ruby-comment cmt"># now since excluded gems start as true, inverting them</span>
|
33
|
+
126: <span class="ruby-comment cmt"># makes them false so we'll skip this gem if any excludes are found</span>
|
34
|
+
127: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">check</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">name</span>,<span class="ruby-identifier">test</span><span class="ruby-operator">|</span> <span class="ruby-operator">!</span><span class="ruby-identifier">test</span>}).<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
35
|
+
128: <span class="ruby-comment cmt"># looks like no needs were set to false, so it's good</span>
|
36
|
+
129: <span class="ruby-identifier">gem_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">Gem</span>.<span class="ruby-identifier">dir</span>, <span class="ruby-value str">"gems"</span>, <span class="ruby-node">"#{gem.name}-#{gem.version}"</span>)
|
37
|
+
130: <span class="ruby-identifier">require</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">gem_dir</span>, <span class="ruby-value str">"lib"</span>, <span class="ruby-identifier">gem</span>.<span class="ruby-identifier">name</span>, <span class="ruby-value str">"init.rb"</span>)
|
38
|
+
131: <span class="ruby-ivar">@gems</span>[<span class="ruby-identifier">gem</span>.<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">gem_dir</span>
|
39
|
+
132: <span class="ruby-keyword kw">end</span>
|
40
|
+
133: <span class="ruby-keyword kw">end</span>
|
41
|
+
134:
|
42
|
+
135: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
43
|
+
136: <span class="ruby-keyword kw">end</span></pre>
|
43
44
|
</body>
|
44
45
|
</html>
|
@@ -10,10 +10,10 @@
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/gem_plugin.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/gem_plugin.rb, line 142</span>
|
14
|
+
142: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">register</span>(<span class="ruby-identifier">category</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">klass</span>)
|
15
|
+
143: <span class="ruby-ivar">@plugins</span>[<span class="ruby-identifier">category</span>] <span class="ruby-operator">||=</span> {}
|
16
|
+
144: <span class="ruby-ivar">@plugins</span>[<span class="ruby-identifier">category</span>][<span class="ruby-identifier">name</span>.<span class="ruby-identifier">downcase</span>] = <span class="ruby-identifier">klass</span>
|
17
|
+
145: <span class="ruby-keyword kw">end</span></pre>
|
18
18
|
</body>
|
19
19
|
</html>
|
@@ -10,20 +10,20 @@
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/gem_plugin.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/gem_plugin.rb, line 152</span>
|
14
|
+
152: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span> = {})
|
15
|
+
153: <span class="ruby-identifier">last_slash</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">rindex</span>(<span class="ruby-value str">"/"</span>)
|
16
|
+
154: <span class="ruby-identifier">category</span> = <span class="ruby-identifier">name</span>[<span class="ruby-value">0</span> <span class="ruby-operator">...</span> <span class="ruby-identifier">last_slash</span>]
|
17
|
+
155: <span class="ruby-identifier">plugin</span> = <span class="ruby-identifier">name</span>[<span class="ruby-identifier">last_slash</span> <span class="ruby-operator">..</span> <span class="ruby-value">-1</span>]
|
18
|
+
156:
|
19
|
+
157: <span class="ruby-identifier">map</span> = <span class="ruby-ivar">@plugins</span>[<span class="ruby-identifier">category</span>]
|
20
|
+
158: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">map</span>
|
21
|
+
159: <span class="ruby-identifier">raise</span> <span class="ruby-node">"Plugin category #{category} does not exist"</span>
|
22
|
+
160: <span class="ruby-keyword kw">elsif</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">map</span>.<span class="ruby-identifier">has_key?</span> <span class="ruby-identifier">plugin</span>
|
23
|
+
161: <span class="ruby-identifier">raise</span> <span class="ruby-node">"Plugin #{plugin} does not exist in category #{category}"</span>
|
24
|
+
162: <span class="ruby-keyword kw">else</span>
|
25
|
+
163: <span class="ruby-identifier">map</span>[<span class="ruby-identifier">plugin</span>].<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>)
|
26
|
+
164: <span class="ruby-keyword kw">end</span>
|
27
|
+
165: <span class="ruby-keyword kw">end</span></pre>
|
28
28
|
</body>
|
29
29
|
</html>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/gem_plugin.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/gem_plugin.rb, line 169</span>
|
14
|
+
169: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">loaded?</span>(<span class="ruby-identifier">gem_name</span>)
|
15
|
+
170: <span class="ruby-ivar">@gems</span>.<span class="ruby-identifier">has_key?</span> <span class="ruby-identifier">gem_name</span>
|
16
|
+
171: <span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|
@@ -10,19 +10,19 @@
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/gem_plugin.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/gem_plugin.rb, line 192</span>
|
14
|
+
192: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">resource</span>(<span class="ruby-identifier">gem_name</span>, <span class="ruby-identifier">path</span>)
|
15
|
+
193: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">loaded?</span> <span class="ruby-identifier">gem_name</span>
|
16
|
+
194: <span class="ruby-identifier">raise</span> <span class="ruby-constant">PluginNotLoaded</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"Plugin #{gem_name} not loaded when getting resource #{path}"</span>)
|
17
|
+
195: <span class="ruby-keyword kw">end</span>
|
18
|
+
196:
|
19
|
+
197: <span class="ruby-identifier">file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@gems</span>[<span class="ruby-identifier">gem_name</span>], <span class="ruby-value str">"resources"</span>, <span class="ruby-identifier">path</span>)
|
20
|
+
198:
|
21
|
+
199: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span> <span class="ruby-identifier">file</span>
|
22
|
+
200: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">file</span>
|
23
|
+
201: <span class="ruby-keyword kw">else</span>
|
24
|
+
202: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
25
|
+
203: <span class="ruby-keyword kw">end</span>
|
26
|
+
204: <span class="ruby-keyword kw">end</span></pre>
|
27
27
|
</body>
|
28
28
|
</html>
|
@@ -10,19 +10,19 @@
|
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/gem_plugin.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/gem_plugin.rb, line 225</span>
|
14
|
+
225: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">config</span>(<span class="ruby-identifier">gem_name</span>, <span class="ruby-identifier">options</span>={})
|
15
|
+
226: <span class="ruby-identifier">config_file</span> = <span class="ruby-constant">Manager</span>.<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">resource</span>(<span class="ruby-identifier">gem_name</span>, <span class="ruby-value str">"/defaults.yaml"</span>)
|
16
|
+
227: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">config_file</span>
|
17
|
+
228: <span class="ruby-keyword kw">begin</span>
|
18
|
+
229: <span class="ruby-identifier">defaults</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load_file</span>(<span class="ruby-identifier">config_file</span>)
|
19
|
+
230: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">defaults</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
|
20
|
+
231: <span class="ruby-keyword kw">rescue</span>
|
21
|
+
232: <span class="ruby-identifier">raise</span> <span class="ruby-node">"Error loading config #{config_file} for gem #{gem_name}"</span>
|
22
|
+
233: <span class="ruby-keyword kw">end</span>
|
23
|
+
234: <span class="ruby-keyword kw">else</span>
|
24
|
+
235: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">options</span>
|
25
|
+
236: <span class="ruby-keyword kw">end</span>
|
26
|
+
237: <span class="ruby-keyword kw">end</span></pre>
|
27
27
|
</body>
|
28
28
|
</html>
|
data/doc/rdoc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Wed Mar 15 01:27:02 EST 2006
|
data/lib/gem_plugin.rb
CHANGED
@@ -93,16 +93,22 @@ module GemPlugin
|
|
93
93
|
# extra thing we do is we delay loading Rails Mongrel plugins until after rails
|
94
94
|
# is configured. Do do this the mongrel_rails script has:
|
95
95
|
#
|
96
|
-
#
|
96
|
+
# GemPlugin::Manager.instance.load "mongrel" => GemPlugin::INCLUDE, "rails" => GemPlugin::EXCLUDE
|
97
97
|
# The only thing to remember is that this is saying "include a plugin if it
|
98
98
|
# depends on gem_plugin, mongrel, but NOT rails". If a plugin also depends on other
|
99
99
|
# stuff then it's loaded just fine. Only gem_plugin, mongrel, and rails are
|
100
100
|
# ever used to determine if it should be included.
|
101
|
+
#
|
102
|
+
# NOTE: Currently RubyGems will run autorequire on gems that get required AND
|
103
|
+
# on their dependencies. This really messes with people running edge rails
|
104
|
+
# since activerecord or other stuff gets loaded for just touching a gem plugin.
|
105
|
+
# To prevent this load requires the full path to the "init.rb" file, which
|
106
|
+
# avoids the RubyGems autorequire magic.
|
101
107
|
def load(needs = {})
|
102
108
|
sdir = File.join(Gem.dir, "specifications")
|
103
109
|
gems = Gem::SourceIndex.from_installed_gems(sdir)
|
104
110
|
needs = needs.merge({"gem_plugin" => INCLUDE})
|
105
|
-
|
111
|
+
|
106
112
|
gems.each do |path, gem|
|
107
113
|
# don't load gems more than once
|
108
114
|
next if @gems.has_key? gem.name
|
@@ -120,8 +126,9 @@ module GemPlugin
|
|
120
126
|
# makes them false so we'll skip this gem if any excludes are found
|
121
127
|
if (check.select {|name,test| !test}).length == 0
|
122
128
|
# looks like no needs were set to false, so it's good
|
123
|
-
|
124
|
-
|
129
|
+
gem_dir = File.join(Gem.dir, "gems", "#{gem.name}-#{gem.version}")
|
130
|
+
require File.join(gem_dir, "lib", gem.name, "init.rb")
|
131
|
+
@gems[gem.name] = gem_dir
|
125
132
|
end
|
126
133
|
end
|
127
134
|
|
data/tools/rakehelp.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: gem_plugin
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version:
|
7
|
-
date: 2006-03-
|
6
|
+
version: 0.2.1
|
7
|
+
date: 2006-03-15 00:00:00 -05:00
|
8
8
|
summary: A plugin system based only on rubygems that uses dependencies only
|
9
9
|
require_paths:
|
10
10
|
- lib
|