cliutils 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/.yardoc/checksums +11 -0
  3. data/.yardoc/object_types +0 -0
  4. data/.yardoc/objects/root.dat +0 -0
  5. data/.yardoc/proxy_types +0 -0
  6. data/doc/CLIUtils/Configuration.html +373 -0
  7. data/doc/CLIUtils/Configurator.html +873 -0
  8. data/doc/CLIUtils/LoggerDelegator.html +560 -0
  9. data/doc/CLIUtils/Messenging.html +396 -0
  10. data/doc/CLIUtils/Prefs.html +609 -0
  11. data/doc/CLIUtils/PrettyIO.html +1333 -0
  12. data/doc/CLIUtils.html +131 -0
  13. data/doc/Hash.html +672 -0
  14. data/doc/Logger.html +233 -0
  15. data/doc/String.html +562 -0
  16. data/doc/_index.html +207 -0
  17. data/doc/class_list.html +54 -0
  18. data/doc/css/common.css +1 -0
  19. data/doc/css/full_list.css +57 -0
  20. data/doc/css/style.css +339 -0
  21. data/doc/file.README.html +415 -0
  22. data/doc/file_list.html +56 -0
  23. data/doc/frames.html +26 -0
  24. data/doc/index.html +415 -0
  25. data/doc/js/app.js +219 -0
  26. data/doc/js/full_list.js +178 -0
  27. data/doc/js/jquery.js +4 -0
  28. data/doc/method_list.html +389 -0
  29. data/doc/top-level-namespace.html +114 -0
  30. data/lib/cliutils/version.rb +1 -1
  31. metadata +29 -57
  32. data/.DS_Store +0 -0
  33. data/README.rdoc +0 -19
  34. data/html/CLIUtils/Configuration.html +0 -271
  35. data/html/CLIUtils/Configurator.html +0 -504
  36. data/html/CLIUtils/LoggerDelegator.html +0 -344
  37. data/html/CLIUtils/Messenging.html +0 -284
  38. data/html/CLIUtils/Prefs.html +0 -330
  39. data/html/CLIUtils/PrettyIO.html +0 -799
  40. data/html/CLIUtils.html +0 -112
  41. data/html/Hash.html +0 -453
  42. data/html/Logger.html +0 -183
  43. data/html/Object.html +0 -120
  44. data/html/README_md.html +0 -454
  45. data/html/String.html +0 -413
  46. data/html/created.rid +0 -13
  47. data/html/fonts/Lato-Light.ttf +0 -0
  48. data/html/fonts/Lato-LightItalic.ttf +0 -0
  49. data/html/fonts/Lato-Regular.ttf +0 -0
  50. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  51. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  52. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  53. data/html/fonts.css +0 -167
  54. data/html/images/add.png +0 -0
  55. data/html/images/arrow_up.png +0 -0
  56. data/html/images/brick.png +0 -0
  57. data/html/images/brick_link.png +0 -0
  58. data/html/images/bug.png +0 -0
  59. data/html/images/bullet_black.png +0 -0
  60. data/html/images/bullet_toggle_minus.png +0 -0
  61. data/html/images/bullet_toggle_plus.png +0 -0
  62. data/html/images/date.png +0 -0
  63. data/html/images/delete.png +0 -0
  64. data/html/images/find.png +0 -0
  65. data/html/images/loadingAnimation.gif +0 -0
  66. data/html/images/macFFBgHack.png +0 -0
  67. data/html/images/package.png +0 -0
  68. data/html/images/page_green.png +0 -0
  69. data/html/images/page_white_text.png +0 -0
  70. data/html/images/page_white_width.png +0 -0
  71. data/html/images/plugin.png +0 -0
  72. data/html/images/ruby.png +0 -0
  73. data/html/images/tag_blue.png +0 -0
  74. data/html/images/tag_green.png +0 -0
  75. data/html/images/transparent.png +0 -0
  76. data/html/images/wrench.png +0 -0
  77. data/html/images/wrench_orange.png +0 -0
  78. data/html/images/zoom.png +0 -0
  79. data/html/index.html +0 -455
  80. data/html/js/darkfish.js +0 -140
  81. data/html/js/jquery.js +0 -18
  82. data/html/js/navigation.js +0 -142
  83. data/html/js/search.js +0 -109
  84. data/html/js/search_index.js +0 -1
  85. data/html/js/searcher.js +0 -228
  86. data/html/rdoc.css +0 -580
  87. data/html/table_of_contents.html +0 -399
@@ -1,504 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>class CLIUtils::Configurator - CLIUtils</title>
8
-
9
- <link href="../fonts.css" rel="stylesheet">
10
- <link href="../rdoc.css" rel="stylesheet">
11
-
12
- <script type="text/javascript">
13
- var rdoc_rel_prefix = "../";
14
- </script>
15
-
16
- <script src="../js/jquery.js"></script>
17
- <script src="../js/navigation.js"></script>
18
- <script src="../js/search_index.js"></script>
19
- <script src="../js/search.js"></script>
20
- <script src="../js/searcher.js"></script>
21
- <script src="../js/darkfish.js"></script>
22
-
23
-
24
- <body id="top" role="document" class="class">
25
- <nav role="navigation">
26
- <div id="project-navigation">
27
- <div id="home-section" role="region" title="Quick navigation" class="nav-section">
28
- <h2>
29
- <a href="../index.html" rel="home">Home</a>
30
- </h2>
31
-
32
- <div id="table-of-contents-navigation">
33
- <a href="../table_of_contents.html#pages">Pages</a>
34
- <a href="../table_of_contents.html#classes">Classes</a>
35
- <a href="../table_of_contents.html#methods">Methods</a>
36
- </div>
37
- </div>
38
-
39
- <div id="search-section" role="search" class="project-section initially-hidden">
40
- <form action="#" method="get" accept-charset="utf-8">
41
- <div id="search-field-wrapper">
42
- <input id="search-field" role="combobox" aria-label="Search"
43
- aria-autocomplete="list" aria-controls="search-results"
44
- type="text" name="search" placeholder="Search" spellcheck="false"
45
- title="Type to search, Up and Down to navigate, Enter to load">
46
- </div>
47
-
48
- <ul id="search-results" aria-label="Search Results"
49
- aria-busy="false" aria-expanded="false"
50
- aria-atomic="false" class="initially-hidden"></ul>
51
- </form>
52
- </div>
53
-
54
- </div>
55
-
56
-
57
- <div class="nav-section">
58
- <h3>Table of Contents</h3>
59
-
60
- <ul class="link-list" role="directory">
61
- <li><a href="#class-CLIUtils::Configurator-label-"></a>
62
- <li><a href="#class-CLIUtils::Configurator-label-"></a>
63
- </ul>
64
- </div>
65
-
66
-
67
- <div id="class-metadata">
68
-
69
- <div id="parent-class-section" class="nav-section">
70
- <h3>Parent</h3>
71
-
72
-
73
- <p class="link">Object
74
-
75
- </div>
76
-
77
-
78
-
79
- <!-- Method Quickref -->
80
- <div id="method-list-section" class="nav-section">
81
- <h3>Methods</h3>
82
-
83
- <ul class="link-list" role="directory">
84
-
85
- <li ><a href="#method-c-new">::new</a>
86
-
87
- <li ><a href="#method-i-add_section">#add_section</a>
88
-
89
- <li ><a href="#method-i-delete_section">#delete_section</a>
90
-
91
- <li ><a href="#method-i-ingest_prefs">#ingest_prefs</a>
92
-
93
- <li ><a href="#method-i-method_missing">#method_missing</a>
94
-
95
- <li ><a href="#method-i-reset">#reset</a>
96
-
97
- <li ><a href="#method-i-save">#save</a>
98
-
99
- </ul>
100
- </div>
101
-
102
- </div>
103
- </nav>
104
-
105
- <main role="main" aria-labelledby="class-CLIUtils::Configurator">
106
- <h1 id="class-CLIUtils::Configurator" class="class">
107
- class CLIUtils::Configurator
108
- </h1>
109
-
110
- <section class="description">
111
-
112
- <h6 id="class-CLIUtils::Configurator-label-"><span><a href="#class-CLIUtils::Configurator-label-">&para;</a> <a href="#documentation">&uarr;</a></span></h6>
113
-
114
- <p><a href="Configuration.html">Configuration</a> Class</p>
115
-
116
- <p>Manages any configuration values and the flat YAML file into which they get
117
- stored.</p>
118
-
119
- <h6 id="class-CLIUtils::Configurator-label-"><span><a href="#class-CLIUtils::Configurator-label-">&para;</a> <a href="#documentation">&uarr;</a></span></h6>
120
-
121
- </section>
122
-
123
-
124
-
125
-
126
- <section id="5Buntitled-5D" class="documentation-section">
127
-
128
-
129
-
130
-
131
-
132
-
133
-
134
- <section class="attribute-method-details" class="method-section">
135
- <header>
136
- <h3>Attributes</h3>
137
- </header>
138
-
139
-
140
- <div id="attribute-i-config_path" class="method-detail">
141
- <div class="method-heading attribute-method-heading">
142
- <span class="method-name">config_path</span><span
143
- class="attribute-access-type">[R]</span>
144
- </div>
145
-
146
- <div class="method-description">
147
-
148
- <h6 id="attribute-i-config_path-label-"><span><a href="#attribute-i-config_path-label-">&para;</a> <a href="#documentation">&uarr;</a></span></h6>
149
-
150
- <p>Attributes</p>
151
-
152
- <h6 id="attribute-i-config_path-label-"><span><a href="#attribute-i-config_path-label-">&para;</a> <a href="#documentation">&uarr;</a></span></h6>
153
-
154
- </div>
155
- </div>
156
-
157
- <div id="attribute-i-data" class="method-detail">
158
- <div class="method-heading attribute-method-heading">
159
- <span class="method-name">data</span><span
160
- class="attribute-access-type">[R]</span>
161
- </div>
162
-
163
- <div class="method-description">
164
-
165
- <h6 id="attribute-i-data-label-"><span><a href="#attribute-i-data-label-">&para;</a> <a href="#documentation">&uarr;</a></span></h6>
166
-
167
- <p>Attributes</p>
168
-
169
- <h6 id="attribute-i-data-label-"><span><a href="#attribute-i-data-label-">&para;</a> <a href="#documentation">&uarr;</a></span></h6>
170
-
171
- </div>
172
- </div>
173
-
174
- </section>
175
-
176
-
177
-
178
- <section id="public-class-5Buntitled-5D-method-details" class="method-section">
179
- <header>
180
- <h3>Public Class Methods</h3>
181
- </header>
182
-
183
-
184
- <div id="method-c-new" class="method-detail ">
185
-
186
- <div class="method-heading">
187
- <span class="method-name">new</span><span
188
- class="method-args">(path)</span>
189
-
190
- <span class="method-click-advice">click to toggle source</span>
191
-
192
- </div>
193
-
194
-
195
- <div class="method-description">
196
-
197
- <h6 id="method-c-new-label-"><span><a href="#method-c-new-label-">&para;</a> <a href="#documentation">&uarr;</a></span></h6>
198
-
199
- <p>Methods</p>
200
-
201
- <h6 id="method-c-new-label-"><span><a href="#method-c-new-label-">&para;</a> <a href="#documentation">&uarr;</a></span></h6>
202
- <hr>
203
-
204
- <p>initialize method</p>
205
-
206
- <p>Initializes configuration from a flat file. @param path The filepath to the
207
- config YAML @return void</p>
208
- <hr>
209
-
210
-
211
-
212
-
213
- <div class="method-source-code" id="new-source">
214
- <pre><span class="ruby-comment"># File lib/cliutils/configurator.rb, line 26</span>
215
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">path</span>)
216
- <span class="ruby-identifier">_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">path</span>)
217
- <span class="ruby-ivar">@config_path</span> = <span class="ruby-identifier">_path</span>
218
- <span class="ruby-ivar">@data</span> = {}
219
-
220
- <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">_path</span>)
221
- <span class="ruby-identifier">data</span> = <span class="ruby-constant">YAML</span><span class="ruby-operator">::</span><span class="ruby-identifier">load_file</span>(<span class="ruby-identifier">_path</span>)
222
- <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">deep_merge!</span>(<span class="ruby-identifier">data</span>).<span class="ruby-identifier">deep_symbolize_keys!</span>
223
- <span class="ruby-keyword">end</span>
224
- <span class="ruby-keyword">end</span></pre>
225
- </div>
226
-
227
- </div>
228
-
229
-
230
-
231
-
232
- </div>
233
-
234
-
235
- </section>
236
-
237
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
238
- <header>
239
- <h3>Public Instance Methods</h3>
240
- </header>
241
-
242
-
243
- <div id="method-i-add_section" class="method-detail ">
244
-
245
- <div class="method-heading">
246
- <span class="method-name">add_section</span><span
247
- class="method-args">(section_name)</span>
248
-
249
- <span class="method-click-advice">click to toggle source</span>
250
-
251
- </div>
252
-
253
-
254
- <div class="method-description">
255
-
256
- <hr>
257
-
258
- <p><a href="Configurator.html#method-i-add_section">#add_section</a> method</p>
259
-
260
- <p>Adds a new section to the config file (if it doesn&#39;t already exist).
261
- @param section_name The section to add @return Void</p>
262
- <hr>
263
-
264
-
265
-
266
-
267
- <div class="method-source-code" id="add_section-source">
268
- <pre><span class="ruby-comment"># File lib/cliutils/configurator.rb, line 45</span>
269
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">add_section</span>(<span class="ruby-identifier">section_name</span>)
270
- <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@data</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">section_name</span>)
271
- <span class="ruby-ivar">@data</span>[<span class="ruby-identifier">section_name</span>] = {}
272
- <span class="ruby-keyword">else</span>
273
- <span class="ruby-identifier">fail</span> <span class="ruby-node">&quot;Section already exists: #{ section_name }&quot;</span>
274
- <span class="ruby-keyword">end</span>
275
- <span class="ruby-keyword">end</span></pre>
276
- </div>
277
-
278
- </div>
279
-
280
-
281
-
282
-
283
- </div>
284
-
285
-
286
- <div id="method-i-delete_section" class="method-detail ">
287
-
288
- <div class="method-heading">
289
- <span class="method-name">delete_section</span><span
290
- class="method-args">(section_name)</span>
291
-
292
- <span class="method-click-advice">click to toggle source</span>
293
-
294
- </div>
295
-
296
-
297
- <div class="method-description">
298
-
299
- <hr>
300
-
301
- <p><a href="Configurator.html#method-i-delete_section">#delete_section</a>
302
- method</p>
303
-
304
- <p>Removes a section to the config file (if it exists). @param section_name
305
- The section to remove @return Void</p>
306
- <hr>
307
-
308
-
309
-
310
-
311
- <div class="method-source-code" id="delete_section-source">
312
- <pre><span class="ruby-comment"># File lib/cliutils/configurator.rb, line 60</span>
313
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">delete_section</span>(<span class="ruby-identifier">section_name</span>)
314
- <span class="ruby-keyword">if</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">section_name</span>)
315
- <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">section_name</span>)
316
- <span class="ruby-keyword">else</span>
317
- <span class="ruby-identifier">fail</span> <span class="ruby-node">&quot;Cannot delete nonexistent section: #{ section_name }&quot;</span>
318
- <span class="ruby-keyword">end</span>
319
- <span class="ruby-keyword">end</span></pre>
320
- </div>
321
-
322
- </div>
323
-
324
-
325
-
326
-
327
- </div>
328
-
329
-
330
- <div id="method-i-ingest_prefs" class="method-detail ">
331
-
332
- <div class="method-heading">
333
- <span class="method-name">ingest_prefs</span><span
334
- class="method-args">(prefs)</span>
335
-
336
- <span class="method-click-advice">click to toggle source</span>
337
-
338
- </div>
339
-
340
-
341
- <div class="method-description">
342
-
343
- <hr>
344
-
345
- <p><a href="Configurator.html#method-i-ingest_prefs">#ingest_prefs</a> method</p>
346
-
347
- <p>Ingests a <a href="Prefs.html">Prefs</a> class and adds its answers to the
348
- configuration data. @param prefs The <a href="Prefs.html">Prefs</a> class
349
- to examine @return Void</p>
350
- <hr>
351
-
352
-
353
-
354
-
355
- <div class="method-source-code" id="ingest_prefs-source">
356
- <pre><span class="ruby-comment"># File lib/cliutils/configurator.rb, line 76</span>
357
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">ingest_prefs</span>(<span class="ruby-identifier">prefs</span>)
358
- <span class="ruby-identifier">fail</span> <span class="ruby-string">&#39;Invaid Prefs class&#39;</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">prefs</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Prefs</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">prefs</span>.<span class="ruby-identifier">answers</span>.<span class="ruby-identifier">nil?</span>
359
- <span class="ruby-identifier">prefs</span>.<span class="ruby-identifier">answers</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
360
- <span class="ruby-identifier">add_section</span>(<span class="ruby-identifier">p</span>[<span class="ruby-value">:section</span>]) <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">p</span>[<span class="ruby-value">:section</span>])
361
- <span class="ruby-ivar">@data</span>[<span class="ruby-identifier">p</span>[<span class="ruby-value">:section</span>]].<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">p</span>[<span class="ruby-value">:key</span>] =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">p</span>[<span class="ruby-value">:answer</span>])
362
- <span class="ruby-keyword">end</span>
363
- <span class="ruby-keyword">end</span></pre>
364
- </div>
365
-
366
- </div>
367
-
368
-
369
-
370
-
371
- </div>
372
-
373
-
374
- <div id="method-i-method_missing" class="method-detail ">
375
-
376
- <div class="method-heading">
377
- <span class="method-name">method_missing</span><span
378
- class="method-args">(name, *args, &block)</span>
379
-
380
- <span class="method-click-advice">click to toggle source</span>
381
-
382
- </div>
383
-
384
-
385
- <div class="method-description">
386
-
387
- <hr>
388
-
389
- <p><a href="Configurator.html#method-i-method_missing">#method_missing</a>
390
- method</p>
391
-
392
- <p>Allows this module to return data from the config <a
393
- href="../Hash.html">Hash</a> when given a method name that matches a key.
394
- @param name @param *args @param &amp;block @return <a
395
- href="../Hash.html">Hash</a></p>
396
- <hr>
397
-
398
-
399
-
400
-
401
- <div class="method-source-code" id="method_missing-source">
402
- <pre><span class="ruby-comment"># File lib/cliutils/configurator.rb, line 94</span>
403
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
404
- <span class="ruby-ivar">@data</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>] <span class="ruby-operator">||</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span> =<span class="ruby-operator">&gt;</span> {})
405
- <span class="ruby-keyword">end</span></pre>
406
- </div>
407
-
408
- </div>
409
-
410
-
411
-
412
-
413
- </div>
414
-
415
-
416
- <div id="method-i-reset" class="method-detail ">
417
-
418
- <div class="method-heading">
419
- <span class="method-name">reset</span><span
420
- class="method-args">()</span>
421
-
422
- <span class="method-click-advice">click to toggle source</span>
423
-
424
- </div>
425
-
426
-
427
- <div class="method-description">
428
-
429
- <hr>
430
-
431
- <p>reset method</p>
432
-
433
- <p>Clears the configuration data. @return Void</p>
434
- <hr>
435
-
436
-
437
-
438
-
439
- <div class="method-source-code" id="reset-source">
440
- <pre><span class="ruby-comment"># File lib/cliutils/configurator.rb, line 104</span>
441
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">reset</span>
442
- <span class="ruby-ivar">@data</span> = {}
443
- <span class="ruby-keyword">end</span></pre>
444
- </div>
445
-
446
- </div>
447
-
448
-
449
-
450
-
451
- </div>
452
-
453
-
454
- <div id="method-i-save" class="method-detail ">
455
-
456
- <div class="method-heading">
457
- <span class="method-name">save</span><span
458
- class="method-args">()</span>
459
-
460
- <span class="method-click-advice">click to toggle source</span>
461
-
462
- </div>
463
-
464
-
465
- <div class="method-description">
466
-
467
- <hr>
468
-
469
- <p>save method</p>
470
-
471
- <p>Saves the configuration data to the previously stored flat file. @return
472
- Void</p>
473
- <hr>
474
-
475
-
476
-
477
-
478
- <div class="method-source-code" id="save-source">
479
- <pre><span class="ruby-comment"># File lib/cliutils/configurator.rb, line 115</span>
480
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">save</span>
481
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-ivar">@config_path</span>, <span class="ruby-string">&#39;w&#39;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span>(<span class="ruby-ivar">@data</span>.<span class="ruby-identifier">deep_stringify_keys</span>.<span class="ruby-identifier">to_yaml</span>) }
482
- <span class="ruby-keyword">end</span></pre>
483
- </div>
484
-
485
- </div>
486
-
487
-
488
-
489
-
490
- </div>
491
-
492
-
493
- </section>
494
-
495
- </section>
496
- </main>
497
-
498
-
499
- <footer id="validator-badges" role="contentinfo">
500
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
501
- <p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
502
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
503
- </footer>
504
-