This file is indexed.

/usr/share/doc/libgemplugin-ruby/doc/rdoc/classes/GemPlugin/Manager.html is in libgemplugin-ruby 0.2.3-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: GemPlugin::Manager</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">GemPlugin::Manager</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/lib/gem_plugin_rb.html">
                lib/gem_plugin.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Object
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
This class is used by people who use gem plugins (but don&#8216;t
necessarily make them) to add plugins to their own systems. It provides a
way to <a href="Manager.html#M000006">load</a> plugins, list them, and <a
href="Manager.html#M000008">create</a> them as needed.
</p>
<p>
It is a singleton so you use like this: GemPlugins::Manager.instance.<a
href="Manager.html#M000006">load</a>
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000011">config</a>&nbsp;&nbsp;
      <a href="#M000008">create</a>&nbsp;&nbsp;
      <a href="#M000006">load</a>&nbsp;&nbsp;
      <a href="#M000009">loaded?</a>&nbsp;&nbsp;
      <a href="#M000005">new</a>&nbsp;&nbsp;
      <a href="#M000007">register</a>&nbsp;&nbsp;
      <a href="#M000010">resource</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->
    <div id="includes">
      <h3 class="section-bar">Included Modules</h3>

      <div id="includes-list">
        <span class="include-name">Singleton</span>
      </div>
    </div>

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">gems</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">plugins</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000005" class="method-detail">
        <a name="M000005"></a>

        <div class="method-heading">
          <a href="Manager.src/M000005.html" target="Code" class="method-signature"
            onclick="popupCode('Manager.src/M000005.html');return false;">
          <span class="method-name">new</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000011" class="method-detail">
        <a name="M000011"></a>

        <div class="method-heading">
          <a href="Manager.src/M000011.html" target="Code" class="method-signature"
            onclick="popupCode('Manager.src/M000011.html');return false;">
          <span class="method-name">config</span><span class="method-args">(gem_name, options={})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
While <a href="Manager.html#M000010">Manager.resource</a> will find
arbitrary resources, a special case is when you need to <a
href="Manager.html#M000006">load</a> a set of configuration defaults. <a
href="../GemPlugin.html">GemPlugin</a> normalizes this to be if you have a
file &quot;resources/defaults.yaml&quot; then you&#8216;ll be able to <a
href="Manager.html#M000006">load</a> them via <a
href="Manager.html#M000011">Manager.config</a>.
</p>
<p>
How you use the method is you get the options the user wants set, pass them
to Manager.instance.<a href="Manager.html#M000011">config</a>, and what you
get back is a <a href="Manager.html#M000005">new</a> Hash with the
user&#8216;s settings overriding the defaults.
</p>
<pre>
  opts = Manager.instance.config &quot;mygem&quot;, :age =&gt; 12, :max_load =&gt; .9
</pre>
<p>
In the above case, if defaults had {:age =&gt; 14} then it would be changed
to 12.
</p>
<p>
This loads the .yaml file on the fly every time, so doing it a whole lot is
very stupid. If you need to make frequent calls to this, call it once with
no options (Manager.instance.<a href="Manager.html#M000011">config</a>)
then use the returned defaults directly from then on.
</p>
        </div>
      </div>

      <div id="method-M000008" class="method-detail">
        <a name="M000008"></a>

        <div class="method-heading">
          <a href="Manager.src/M000008.html" target="Code" class="method-signature"
            onclick="popupCode('Manager.src/M000008.html');return false;">
          <span class="method-name">create</span><span class="method-args">(name, options = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Resolves the given name (should include /category/name) to find the plugin
class and <a href="Manager.html#M000008">create</a> an instance. You can
pass a second hash option that is then given to the Plugin to configure it.
</p>
        </div>
      </div>

      <div id="method-M000006" class="method-detail">
        <a name="M000006"></a>

        <div class="method-heading">
          <a href="Manager.src/M000006.html" target="Code" class="method-signature"
            onclick="popupCode('Manager.src/M000006.html');return false;">
          <span class="method-name">load</span><span class="method-args">(needs = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Responsible for going through the list of available gems and loading any
plugins requested. It keeps track of what it&#8216;s loaded already and
won&#8216;t <a href="Manager.html#M000006">load</a> them again.
</p>
<p>
It accepts one parameter which is a hash of gem depends that should include
or exclude a gem from being loaded. A gem must depend on gem_plugin to be
considered, but then each system has to add it&#8216;s own INCLUDE to make
sure that only plugins related to it are loaded.
</p>
<p>
An example again comes from Mongrel. In order to <a
href="Manager.html#M000006">load</a> all Mongrel plugins:
</p>
<pre>
 GemPlugin::Manager.instance.load &quot;mongrel&quot; =&gt; GemPlugin::INCLUDE
</pre>
<p>
Which will <a href="Manager.html#M000006">load</a> all plugins that depend
on mongrel AND gem_plugin. Now, one extra thing we do is we delay loading
Rails Mongrel plugins until after rails is configured. Do do this the
mongrel_rails script has:
</p>
<p>
GemPlugin::Manager.instance.<a href="Manager.html#M000006">load</a>
&quot;mongrel&quot; =&gt; GemPlugin::INCLUDE, &quot;rails&quot; =&gt;
GemPlugin::EXCLUDE The only thing to remember is that this is saying
&quot;include a plugin if it depends on gem_plugin, mongrel, but NOT
rails&quot;. If a plugin also depends on other stuff then it&#8216;s loaded
just fine. Only gem_plugin, mongrel, and rails are ever used to determine
if it should be included.
</p>
<p>
NOTE: Currently RubyGems will run autorequire on gems that get required AND
on their dependencies. This really messes with people running edge rails
since activerecord or other stuff gets loaded for just touching a gem
plugin. To prevent this <a href="Manager.html#M000006">load</a> requires
the full path to the &quot;init.rb&quot; file, which avoids the RubyGems
autorequire magic.
</p>
        </div>
      </div>

      <div id="method-M000009" class="method-detail">
        <a name="M000009"></a>

        <div class="method-heading">
          <a href="Manager.src/M000009.html" target="Code" class="method-signature"
            onclick="popupCode('Manager.src/M000009.html');return false;">
          <span class="method-name">loaded?</span><span class="method-args">(gem_name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Simply says whether the given gem has been loaded yet or not.
</p>
        </div>
      </div>

      <div id="method-M000007" class="method-detail">
        <a name="M000007"></a>

        <div class="method-heading">
          <a href="Manager.src/M000007.html" target="Code" class="method-signature"
            onclick="popupCode('Manager.src/M000007.html');return false;">
          <span class="method-name">register</span><span class="method-args">(category, name, klass)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Not necessary for you to call directly, but this is how <a
href="Base.html#M000002">GemPlugin::Base.inherited</a> actually adds a
plugin to a category.
</p>
        </div>
      </div>

      <div id="method-M000010" class="method-detail">
        <a name="M000010"></a>

        <div class="method-heading">
          <a href="Manager.src/M000010.html" target="Code" class="method-signature"
            onclick="popupCode('Manager.src/M000010.html');return false;">
          <span class="method-name">resource</span><span class="method-args">(gem_name, path)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
GemPlugins can have a &#8216;resources&#8217; directory which is packaged
with them and can hold any data resources the plugin may need. The main
problem is that it&#8216;s difficult to figure out where these resources
are actually located on the file system. The <a
href="Manager.html#M000010">resource</a> method tries to locate the real
path for a given <a href="Manager.html#M000010">resource</a> path.
</p>
<p>
Let&#8216;s say you have a &#8216;resources/stylesheets/default.css&#8217;
file in your gem distribution, then finding where this file really is
involves:
</p>
<pre>
  Manager.instance.resource(&quot;mygem&quot;, &quot;/stylesheets/default.css&quot;)
</pre>
<p>
You either get back the full path to the <a
href="Manager.html#M000010">resource</a> or you get a nil if it
doesn&#8216;t exist.
</p>
<p>
If you request a path for a <a href="../GemPlugin.html">GemPlugin</a> that
hasn&#8216;t been loaded yet then it will throw an <a
href="PluginNotLoaded.html">PluginNotLoaded</a> exception. The gem may be
present on your system in this case, but you just haven&#8216;t loaded it
with Manager.instance.<a href="Manager.html#M000006">load</a> properly.
</p>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>