inochi 0.3.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data/CREDITS +1 -0
  2. data/bin/inochi +112 -104
  3. data/doc/api/classes/Array.html +370 -0
  4. data/doc/api/classes/File.html +110 -0
  5. data/doc/api/classes/Inochi.html +1493 -0
  6. data/doc/api/classes/Inochi/Manual.html +157 -0
  7. data/doc/api/classes/Inochi/Phrases.html +331 -0
  8. data/doc/api/classes/Inochi/Version.html +190 -0
  9. data/doc/api/classes/TempDir.html +164 -0
  10. data/doc/api/created.rid +1 -0
  11. data/doc/api/css/main.css +263 -0
  12. data/doc/api/css/panel.css +383 -0
  13. data/doc/api/css/reset.css +53 -0
  14. data/doc/api/files/CREDITS.html +61 -0
  15. data/doc/api/files/LICENSE.html +76 -0
  16. data/doc/api/files/lib/inochi/book_rb.html +96 -0
  17. data/doc/api/files/lib/inochi/init_rb.html +78 -0
  18. data/doc/api/files/lib/inochi/main_rb.html +52 -0
  19. data/doc/api/files/lib/inochi/rake_rb.html +52 -0
  20. data/doc/api/files/lib/inochi/test/bacon_rb.html +67 -0
  21. data/doc/api/files/lib/inochi/test/context_rb.html +69 -0
  22. data/doc/api/files/lib/inochi/test/dfect_rb.html +67 -0
  23. data/doc/api/files/lib/inochi/test/matchy_rb.html +69 -0
  24. data/doc/api/files/lib/inochi/test/minitest_rb.html +71 -0
  25. data/doc/api/files/lib/inochi/test/mocha_rb.html +67 -0
  26. data/doc/api/files/lib/inochi/test/rspec_rb.html +67 -0
  27. data/doc/api/files/lib/inochi/test/shoulda_rb.html +67 -0
  28. data/doc/api/files/lib/inochi/test/test_spec_rb.html +67 -0
  29. data/doc/api/files/lib/inochi/test/test_unit_rb.html +67 -0
  30. data/doc/api/files/lib/inochi/util/combo_rb.html +59 -0
  31. data/doc/api/files/lib/inochi/util/tempdir_rb.html +68 -0
  32. data/doc/api/files/lib/inochi/util_rb.html +59 -0
  33. data/doc/api/files/lib/inochi_rb.html +78 -0
  34. data/doc/api/i/arrows.png +0 -0
  35. data/doc/api/i/results_bg.png +0 -0
  36. data/doc/api/i/tree_bg.png +0 -0
  37. data/doc/api/index.html +14 -18
  38. data/doc/api/js/jquery-1.3.2.min.js +19 -0
  39. data/doc/api/js/jquery-effect.js +593 -0
  40. data/doc/api/js/main.js +22 -0
  41. data/doc/api/js/searchdoc.js +605 -0
  42. data/doc/api/panel/index.html +63 -0
  43. data/doc/api/panel/search_index.js +1 -0
  44. data/doc/api/panel/tree.js +1 -0
  45. data/doc/history.erb +75 -34
  46. data/doc/index.erb +10 -5
  47. data/doc/index.xhtml +806 -1145
  48. data/doc/intro.erb +33 -27
  49. data/doc/setup.erb +16 -15
  50. data/doc/usage.erb +86 -137
  51. data/lib/inochi.rb +25 -13
  52. data/lib/inochi/book.rb +13 -6
  53. data/lib/inochi/init.rb +41 -24
  54. data/lib/inochi/main.rb +17 -7
  55. data/lib/inochi/rake.rb +200 -59
  56. data/lib/inochi/test/bacon.rb +3 -0
  57. data/lib/inochi/test/context.rb +4 -0
  58. data/lib/inochi/test/dfect.rb +3 -0
  59. data/lib/inochi/test/matchy.rb +4 -0
  60. data/lib/inochi/test/minitest.rb +7 -0
  61. data/lib/inochi/test/mocha.rb +3 -0
  62. data/lib/inochi/test/rspec.rb +3 -0
  63. data/lib/inochi/test/shoulda.rb +3 -0
  64. data/lib/inochi/test/test_spec.rb +3 -0
  65. data/lib/inochi/test/test_unit.rb +3 -0
  66. data/lib/inochi/util.rb +23 -1
  67. data/lib/inochi/util/combo.rb +191 -0
  68. data/lib/inochi/util/tempdir.rb +29 -0
  69. data/rakefile +12 -0
  70. data/test/inochi.rb +5 -0
  71. metadata +119 -45
  72. data/Rakefile +0 -6
  73. data/doc/api/Inochi.html +0 -2574
  74. data/doc/api/Inochi/Manual.html +0 -230
  75. data/doc/api/Inochi/Phrases.html +0 -409
  76. data/doc/api/Inochi/Version.html +0 -222
  77. data/doc/api/all-methods.html +0 -180
  78. data/doc/api/all-namespaces.html +0 -28
  79. data/doc/api/app.js +0 -18
  80. data/doc/api/jquery.js +0 -11
  81. data/doc/api/readme.html +0 -38
  82. data/doc/api/style.css +0 -68
  83. data/doc/api/syntax_highlight.css +0 -21
  84. data/doc/theory.erb +0 -3
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require 'lib/inochi'
2
-
3
- Inochi.rake :Inochi,
4
- :rubyforge_project => 'sunaku',
5
- :upload_target => File.expand_path('~/www/lib/inochi/'),
6
- :upload_delete => true
@@ -1,2574 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
- <html>
4
- <head>
5
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
6
- <link rel="stylesheet" href="style.css" type="text/css" charset="utf-8" />
7
- <link rel="stylesheet" href="syntax_highlight.css" type="text/css" charset="utf-8" />
8
-
9
- <script src="jquery.js" type="text/javascript" charset="utf-8"></script>
10
- <script src="app.js" type="text/javascript" charset="utf-8"></script>
11
- <title>Module: Inochi</title>
12
- </head>
13
- <body>
14
- <div id="content">
15
- <div class="section module Inochi">
16
- <h1 class="title">Module: Inochi</h1>
17
- <div class="section constants">
18
-
19
- </div> <div class="section visibilitygroup public">
20
- <h1>Public Visibility</h1>
21
- <div class="section methodsummary class public">
22
- <h1>Public Class Method Summary</h1>
23
- <table class="summary">
24
-
25
- <tr>
26
- <th class="signature">
27
- <span class='name'><a title="book" href="#book-class_method">book</a></span><span class='args'>(project_symbol, book_template)</span>
28
- <span class='block'></span>
29
-
30
- </th>
31
- <td class="docstring">
32
- <p>
33
- Provides a common configuration for the project&#8217;s user manual:.
34
- </p>
35
-
36
-
37
- </td>
38
- </tr>
39
-
40
- <tr>
41
- <th class="signature">
42
- <span class='name'><a title="calc_program_name" href="#calc_program_name-class_method">calc_program_name</a></span><span class='args'>(project_symbol)</span>
43
- <span class='block'></span>
44
-
45
- </th>
46
- <td class="docstring">
47
- <p>
48
- Returns the name of the main program executable, which is the same as the
49
- project name fully in lowercase.
50
- </p>
51
-
52
-
53
- </td>
54
- </tr>
55
-
56
- <tr>
57
- <th class="signature">
58
- <span class='name'><a title="calc_project_symbol" href="#calc_project_symbol-class_method">calc_project_symbol</a></span><span class='args'>(project_name)</span>
59
- <span class='block'></span>
60
-
61
- </th>
62
- <td class="docstring">
63
- <p>
64
- Calculates the name of the project module from the given project name.
65
- </p>
66
-
67
-
68
- </td>
69
- </tr>
70
-
71
- <tr>
72
- <th class="signature">
73
- <span class='name'><a title="camel_to_snake_case" href="#camel_to_snake_case-class_method">camel_to_snake_case</a></span><span class='args'>(input)</span>
74
- <span class='block'></span>
75
-
76
- </th>
77
- <td class="docstring">
78
- <p>
79
- Transforms the given input from CamelCase to snake_case.
80
- </p>
81
-
82
-
83
- </td>
84
- </tr>
85
-
86
- <tr>
87
- <th class="signature">
88
- <span class='name'><a title="init" href="#init-class_method">init</a></span><span class='args'>(project_symbol, project_config = )</span>
89
- <span class='block'></span>
90
-
91
- </th>
92
- <td class="docstring">
93
- <p>
94
- Establishes your project in Ruby&#8217;s runtime environment by defining
95
- the project module (which serves as a namespace for all code in the
96
- project) and providing a common configuration for the project module:.
97
- </p>
98
-
99
-
100
- <p class='returns'>
101
- Returns:
102
- <span class='return_types'>
103
- <tt>Module</tt>
104
- </span>
105
- </p>
106
-
107
- </td>
108
- </tr>
109
-
110
- <tr>
111
- <th class="signature">
112
- <span class='name'><a title="main" href="#main-class_method">main</a></span><span class='args'>(project_symbol, *trollop_args, &amp;trollop_config)</span>
113
- <span class='block'></span>
114
-
115
- </th>
116
- <td class="docstring">
117
- <p>
118
- Provides a common configuration for the main project executable:.
119
- </p>
120
-
121
-
122
- </td>
123
- </tr>
124
-
125
- <tr>
126
- <th class="signature">
127
- <span class='name'><a title="rake" href="#rake-class_method">rake</a></span><span class='args'>(project_symbol, options = )</span>
128
- <span class='block'>{|gem_spec| ... }</span>
129
-
130
- </th>
131
- <td class="docstring">
132
- <p>
133
- Provides Rake tasks for packaging, publishing, and announcing your project.
134
- </p>
135
-
136
-
137
- </td>
138
- </tr>
139
-
140
- </table>
141
- </div>
142
- <div class="section methoddetails class public">
143
- <h1>Public Class Method Details</h1>
144
-
145
- <div class="method">
146
- <div class="method_header">
147
- <h3>book</h3>
148
- </div><div id="book-class_method" class="section method">
149
- <div class="details_title">
150
- <div class='section methodsignature'>
151
- <tt class='def'>
152
- <span class='visibility'>public</span>
153
- <span class='return_types'></span>
154
- <span class='name'>book</span><span class='args'>(project_symbol, book_template)</span>
155
- <span class='block'></span>
156
- </tt>
157
- </div>
158
-
159
- </div><div class="section docstring">
160
- <p>
161
- Provides a common configuration for the project&#8217;s user manual:
162
- </p>
163
- <ul>
164
- <li>Assigns the title, subtitle, date, and authors for the document.
165
-
166
- <p>
167
- You may override these assignments by reassigning these document parameters
168
- AFTER this method is invoked.
169
- </p>
170
- <p>
171
- Refer to the &quot;document parameters&quot; for the XHTML format in the
172
- &quot;erbook&quot; user manual for details.
173
- </p>
174
- </li>
175
- <li>Provides the project&#8217;s configuration as global variables in the
176
- document.
177
-
178
- <p>
179
- For example, &lt;%= $version %&gt; is the same as &lt;%=
180
- project_module::VERSION %&gt; in the document.
181
- </p>
182
- </li>
183
- <li>Defines a &quot;project_summary&quot; node for use in the document. The
184
- body of this node should contain a brief introduction to the project.
185
-
186
- </li>
187
- <li>Defines a &quot;project_history&quot; node for use in the document. The
188
- body of this node should contain other nodes, each of which represent a
189
- single set of release notes for one of the project&#8217;s releases.
190
-
191
- </li>
192
- </ul>
193
- <p>
194
- It is assumed that this method is called from within the Inochi.rake()
195
- environment.
196
- </p>
197
-
198
- </div><div class="section tags">
199
- <h2>Meta Tags</h2>
200
- <div class="param">
201
- <h3>Parameters:</h3>
202
- <dl>
203
-
204
-
205
- <dt>
206
- <span class='type'>[<tt>Symbol</tt>]</span>
207
- <span class='name'>project_symbol</span>
208
-
209
- </dt>
210
- <dd>
211
- <span class='desc'><p>
212
- Name of the Ruby constant which serves as a namespace for the entire
213
- project.
214
- </p>
215
- </span>
216
- </dd>
217
-
218
-
219
-
220
- <dt>
221
- <span class='type'>[<tt>ERBook::Document::Template</tt>]</span>
222
- <span class='name'>book_template</span>
223
-
224
- </dt>
225
- <dd>
226
- <span class='desc'><p>
227
- The eRuby template which serves as the documentation for the project.
228
- </p>
229
- </span>
230
- </dd>
231
-
232
-
233
- </dl>
234
- </div>
235
- </div><div class="section source">
236
- <span>[<a class="source_link" href="#">View source</a>]</span>
237
- <div class="source_code">
238
- <table>
239
- <tr>
240
- <td>
241
- <pre class="lines">
242
-
243
-
244
- 35
245
- 36
246
- 37
247
- 38
248
- 39
249
- 40
250
- 41
251
- 42
252
- 43
253
- 44
254
- 45
255
- 46
256
- 47
257
- 48
258
- 49
259
- 50
260
- 51
261
- 52
262
- 53
263
- 54
264
- 55
265
- 56
266
- 57</pre>
267
- </td>
268
- <td>
269
- <pre class="code"><span class="info file"># File 'lib/inochi/book.rb', line 35</span>
270
-
271
- <span class='def def kw'>def</span> <span class='book identifier id'>book</span> <span class='project_symbol identifier id'>project_symbol</span><span class='comma token'>,</span> <span class='book_template identifier id'>book_template</span>
272
- <span class='project_module identifier id'>project_module</span> <span class='assign token'>=</span> <span class='fetch_project_module identifier id'>fetch_project_module</span><span class='lparen token'>(</span><span class='project_symbol identifier id'>project_symbol</span><span class='rparen token'>)</span>
273
-
274
- <span class='comment val'># provide project constants as global variables to the user manual</span>
275
- <span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='INOCHI constant id'>INOCHI</span><span class='dot token'>.</span><span class='each_pair identifier id'>each_pair</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='param identifier id'>param</span><span class='comma token'>,</span> <span class='value identifier id'>value</span><span class='bitor op'>|</span>
276
- <span class='eval identifier id'>eval</span> <span class='dstring node'>&quot;$#{param} = value&quot;</span><span class='comma token'>,</span> <span class='binding identifier id'>binding</span>
277
- <span class='end end kw'>end</span>
278
-
279
- <span class='comment val'># set document parameters for the user manual</span>
280
- <span class='$title gvar id'>$title</span> <span class='assign token'>=</span> <span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='DISPLAY constant id'>DISPLAY</span>
281
- <span class='$subtitle gvar id'>$subtitle</span> <span class='assign token'>=</span> <span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='TAGLINE constant id'>TAGLINE</span>
282
- <span class='$feeds gvar id'>$feeds</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span> <span class='File constant id'>File</span><span class='dot token'>.</span><span class='join identifier id'>join</span><span class='lparen token'>(</span><span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='DOCSITE constant id'>DOCSITE</span><span class='comma token'>,</span> <span class='string val'>'ann.xml'</span><span class='rparen token'>)</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='symbol val'>:rss</span> <span class='rbrace token'>}</span>
283
- <span class='$authors gvar id'>$authors</span> <span class='assign token'>=</span> <span class='Hash constant id'>Hash</span><span class='lbrack token'>[</span>
284
- <span class='mult op'>*</span><span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='AUTHORS constant id'>AUTHORS</span><span class='dot token'>.</span><span class='map identifier id'>map</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='name identifier id'>name</span><span class='comma token'>,</span> <span class='addr identifier id'>addr</span><span class='bitor op'>|</span>
285
- <span class='comment val'># convert raw e-mail addresses into URLs for the erbook XHTML format</span>
286
- <span class='addr identifier id'>addr</span> <span class='assign token'>=</span> <span class='dstring node'>&quot;mailto:#{addr}&quot;</span> <span class='unless unless_mod kw'>unless</span> <span class='addr identifier id'>addr</span> <span class='match op'>=~</span> <span class='regexp val'>/^\w+:/</span>
287
-
288
- <span class='lbrack token'>[</span><span class='name identifier id'>name</span><span class='comma token'>,</span> <span class='addr identifier id'>addr</span><span class='rbrack token'>]</span>
289
- <span class='end end kw'>end</span><span class='dot token'>.</span><span class='flatten identifier id'>flatten</span>
290
- <span class='rbrack token'>]</span>
291
-
292
- <span class='book_template identifier id'>book_template</span><span class='dot token'>.</span><span class='extend identifier id'>extend</span> <span class='Manual constant id'>Manual</span>
293
- <span class='end end kw'>end</span>
294
- </pre>
295
- </td>
296
- </tr>
297
- </table>
298
- </div>
299
- </div>
300
- </div>
301
- </div>
302
-
303
- <div class="method">
304
- <div class="method_header">
305
- <h3>calc_program_name</h3>
306
- </div><div id="calc_program_name-class_method" class="section method">
307
- <div class="details_title">
308
- <div class='section methodsignature'>
309
- <tt class='def'>
310
- <span class='visibility'>public</span>
311
- <span class='return_types'></span>
312
- <span class='name'>calc_program_name</span><span class='args'>(project_symbol)</span>
313
- <span class='block'></span>
314
- </tt>
315
- </div>
316
-
317
- </div><div class="section docstring">
318
- <p>
319
- Returns the name of the main program executable, which is the same as the
320
- project name fully in lowercase.
321
- </p>
322
-
323
- </div><div class="section source">
324
- <span>[<a class="source_link" href="#">View source</a>]</span>
325
- <div class="source_code">
326
- <table>
327
- <tr>
328
- <td>
329
- <pre class="lines">
330
-
331
-
332
- 6
333
- 7
334
- 8</pre>
335
- </td>
336
- <td>
337
- <pre class="code"><span class="info file"># File 'lib/inochi/util.rb', line 6</span>
338
-
339
- <span class='def def kw'>def</span> <span class='calc_program_name identifier id'>calc_program_name</span> <span class='project_symbol identifier id'>project_symbol</span>
340
- <span class='camel_to_snake_case identifier id'>camel_to_snake_case</span><span class='lparen token'>(</span><span class='project_symbol identifier id'>project_symbol</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='downcase identifier id'>downcase</span>
341
- <span class='end end kw'>end</span>
342
- </pre>
343
- </td>
344
- </tr>
345
- </table>
346
- </div>
347
- </div>
348
- </div>
349
- </div>
350
-
351
- <div class="method">
352
- <div class="method_header">
353
- <h3>calc_project_symbol</h3>
354
- </div><div id="calc_project_symbol-class_method" class="section method">
355
- <div class="details_title">
356
- <div class='section methodsignature'>
357
- <tt class='def'>
358
- <span class='visibility'>public</span>
359
- <span class='return_types'></span>
360
- <span class='name'>calc_project_symbol</span><span class='args'>(project_name)</span>
361
- <span class='block'></span>
362
- </tt>
363
- </div>
364
-
365
- </div><div class="section docstring">
366
- <p>
367
- Calculates the name of the project module from the given project name.
368
- </p>
369
-
370
- </div><div class="section source">
371
- <span>[<a class="source_link" href="#">View source</a>]</span>
372
- <div class="source_code">
373
- <table>
374
- <tr>
375
- <td>
376
- <pre class="lines">
377
-
378
-
379
- 13
380
- 14
381
- 15
382
- 16</pre>
383
- </td>
384
- <td>
385
- <pre class="code"><span class="info file"># File 'lib/inochi/util.rb', line 13</span>
386
-
387
- <span class='def def kw'>def</span> <span class='calc_project_symbol identifier id'>calc_project_symbol</span> <span class='project_name identifier id'>project_name</span>
388
- <span class='name identifier id'>name</span> <span class='assign token'>=</span> <span class='project_name identifier id'>project_name</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span><span class='dot token'>.</span><span class='gsub identifier id'>gsub</span><span class='lparen token'>(</span><span class='regexp val'>/\W+/</span><span class='comma token'>,</span> <span class='string val'>'_'</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='squeeze identifier id'>squeeze</span><span class='lparen token'>(</span><span class='string val'>'_'</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='gsub identifier id'>gsub</span><span class='lparen token'>(</span><span class='regexp val'>/^_|_$/</span><span class='comma token'>,</span> <span class='string val'>''</span><span class='rparen token'>)</span>
389
- <span class='lparen token'>(</span><span class='name identifier id'>name</span><span class='lbrack token'>[</span><span class='integer val'>0</span><span class='comma token'>,</span><span class='integer val'>1</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='upcase identifier id'>upcase</span> <span class='plus op'>+</span> <span class='name identifier id'>name</span><span class='lbrack token'>[</span><span class='float val'>1</span><span class='dot2 op'>..</span><span class='integer val'>-1</span><span class='rbrack token'>]</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='to_sym identifier id'>to_sym</span>
390
- <span class='end end kw'>end</span>
391
- </pre>
392
- </td>
393
- </tr>
394
- </table>
395
- </div>
396
- </div>
397
- </div>
398
- </div>
399
-
400
- <div class="method">
401
- <div class="method_header">
402
- <h3>camel_to_snake_case</h3>
403
- </div><div id="camel_to_snake_case-class_method" class="section method">
404
- <div class="details_title">
405
- <div class='section methodsignature'>
406
- <tt class='def'>
407
- <span class='visibility'>public</span>
408
- <span class='return_types'></span>
409
- <span class='name'>camel_to_snake_case</span><span class='args'>(input)</span>
410
- <span class='block'></span>
411
- </tt>
412
- </div>
413
-
414
- </div><div class="section docstring">
415
- <p>
416
- Transforms the given input from CamelCase to snake_case.
417
- </p>
418
-
419
- </div><div class="section source">
420
- <span>[<a class="source_link" href="#">View source</a>]</span>
421
- <div class="source_code">
422
- <table>
423
- <tr>
424
- <td>
425
- <pre class="lines">
426
-
427
-
428
- 21
429
- 22
430
- 23
431
- 24
432
- 25
433
- 26
434
- 27
435
- 28
436
- 29
437
- 30
438
- 31
439
- 32
440
- 33</pre>
441
- </td>
442
- <td>
443
- <pre class="code"><span class="info file"># File 'lib/inochi/util.rb', line 21</span>
444
-
445
- <span class='def def kw'>def</span> <span class='camel_to_snake_case identifier id'>camel_to_snake_case</span> <span class='input identifier id'>input</span>
446
- <span class='input identifier id'>input</span> <span class='assign token'>=</span> <span class='input identifier id'>input</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span><span class='dot token'>.</span><span class='dup identifier id'>dup</span>
447
-
448
- <span class='comment val'># handle camel case like FooBar =&gt; Foo_Bar</span>
449
- <span class='while while kw'>while</span> <span class='input identifier id'>input</span><span class='dot token'>.</span><span class='gsub! fid id'>gsub!</span><span class='lparen token'>(</span><span class='regexp val'>/([a-z]+)([A-Z])(\w+)/</span><span class='rparen token'>)</span> <span class='lbrace token'>{</span> <span class='$1 nth_ref id'>$1</span> <span class='plus op'>+</span> <span class='string val'>'_'</span> <span class='plus op'>+</span> <span class='$2 nth_ref id'>$2</span> <span class='plus op'>+</span> <span class='$3 nth_ref id'>$3</span> <span class='rbrace token'>}</span>
450
- <span class='end end kw'>end</span>
451
-
452
- <span class='comment val'># handle abbreviations like XMLParser =&gt; XML_Parser</span>
453
- <span class='while while kw'>while</span> <span class='input identifier id'>input</span><span class='dot token'>.</span><span class='gsub! fid id'>gsub!</span><span class='lparen token'>(</span><span class='regexp val'>/([A-Z]+)([A-Z])([a-z]+)/</span><span class='rparen token'>)</span> <span class='lbrace token'>{</span> <span class='$1 nth_ref id'>$1</span> <span class='plus op'>+</span> <span class='string val'>'_'</span> <span class='plus op'>+</span> <span class='$2 nth_ref id'>$2</span> <span class='plus op'>+</span> <span class='$3 nth_ref id'>$3</span> <span class='rbrace token'>}</span>
454
- <span class='end end kw'>end</span>
455
-
456
- <span class='input identifier id'>input</span>
457
- <span class='end end kw'>end</span>
458
- </pre>
459
- </td>
460
- </tr>
461
- </table>
462
- </div>
463
- </div>
464
- </div>
465
- </div>
466
-
467
- <div class="method">
468
- <div class="method_header">
469
- <h3>init</h3>
470
- </div><div id="init-class_method" class="section method">
471
- <div class="details_title">
472
- <div class='section methodsignature'>
473
- <tt class='def'>
474
- <span class='visibility'>public</span>
475
- <span class='return_types'><tt>Module</tt></span>
476
- <span class='name'>init</span><span class='args'>(project_symbol, project_config = )</span>
477
- <span class='block'></span>
478
- </tt>
479
- </div>
480
-
481
- </div><div class="section docstring">
482
- <p>
483
- Establishes your project in Ruby&#8217;s runtime environment by defining
484
- the project module (which serves as a namespace for all code in the
485
- project) and providing a common configuration for the project module:
486
- </p>
487
- <ul>
488
- <li>Adds the project lib/ directory to the Ruby load path.
489
-
490
- </li>
491
- <li>Defines the INOCHI constant in the project module. This constant contains
492
- the effective configuration parameters (@see project_config).
493
-
494
- </li>
495
- <li>Defines all configuration parameters as constants in the project module.
496
-
497
- </li>
498
- </ul>
499
- <p>
500
- This method must be invoked from immediately within (that is, not from
501
- within any of its descendant directories) the project lib/ directory.
502
- Ideally, this method would be invoked from the main project library.
503
- </p>
504
-
505
- </div><div class="section tags">
506
- <h2>Meta Tags</h2>
507
- <div class="param">
508
- <h3>Parameters:</h3>
509
- <dl>
510
-
511
-
512
- <dt>
513
- <span class='type'>[<tt>Symbol</tt>]</span>
514
- <span class='name'>project_symbol</span>
515
-
516
- </dt>
517
- <dd>
518
- <span class='desc'><p>
519
- Name of the Ruby constant which serves as a namespace for the entire
520
- project.
521
- </p>
522
- </span>
523
- </dd>
524
-
525
-
526
-
527
- <dt>
528
- <span class='type'>[<tt>Hash</tt>]</span>
529
- <span class='name'>project_config</span>
530
-
531
- <em class="default">(defaults to: <tt></tt>)</em>
532
-
533
- </dt>
534
- <dd>
535
- <span class='desc'><p>
536
- Project configuration parameters:
537
- </p>
538
- <dl>
539
- <dt>String</dt><dd>:project =&gt; Name of the project.
540
-
541
- </dd>
542
- </dl>
543
- <p>
544
- The default value is the value of the project_symbol parameter.
545
- </p>
546
- <dl>
547
- <dt>String</dt><dd>:tagline =&gt; An enticing, single line description of the project.
548
-
549
- </dd>
550
- </dl>
551
- <p>
552
- The default value is an empty string.
553
- </p>
554
- <dl>
555
- <dt>String</dt><dd>:website =&gt; URL of the published project website.
556
-
557
- </dd>
558
- </dl>
559
- <p>
560
- The default value is an empty string.
561
- </p>
562
- <dl>
563
- <dt>String</dt><dd>:docsite =&gt; URL of the published user manual.
564
-
565
- </dd>
566
- </dl>
567
- <p>
568
- The default value is the same value as the :website parameter.
569
- </p>
570
- <dl>
571
- <dt>String</dt><dd>:program =&gt; Name of the main project executable.
572
-
573
- </dd>
574
- </dl>
575
- <p>
576
- The default value is the value of the :project parameter in lowercase and
577
- CamelCase converted into snake_case.
578
- </p>
579
- <dl>
580
- <dt>String</dt><dd>:version =&gt; Version of the project.
581
-
582
- </dd>
583
- </dl>
584
- <p>
585
- The default value is &quot;0.0.0&quot;.
586
- </p>
587
- <dl>
588
- <dt>String</dt><dd>:release =&gt; Date when this version was released.
589
-
590
- </dd>
591
- </dl>
592
- <p>
593
- The default value is the current time.
594
- </p>
595
- <dl>
596
- <dt>String</dt><dd>:display =&gt; How the project name should be displayed.
597
-
598
- </dd>
599
- </dl>
600
- <p>
601
- The default value is the project name and version together.
602
- </p>
603
- <dl>
604
- <dt>String</dt><dd>:install =&gt; Path to the directory which contains the project.
605
-
606
- </dd>
607
- </dl>
608
- <p>
609
- The default value is one directory above the parent directory of the file
610
- from which this method was called.
611
- </p>
612
- <dl>
613
- <dt>Hash</dt><dd>:require =&gt; The names and version constraints of ruby gems required by
614
- this project. This information must be expressed as follows:
615
-
616
- </dd>
617
- </dl>
618
- <ul>
619
- <li>Each hash key must be the name of a ruby gem.
620
-
621
- </li>
622
- <li>Each hash value must be either <tt>nil</tt>, a single version number
623
- requirement string (see Gem::Requirement) or an Array thereof.
624
-
625
- </li>
626
- </ul>
627
- <p>
628
- The default value is an empty Hash.
629
- </p>
630
- </span>
631
- </dd>
632
-
633
-
634
- </dl>
635
- </div><div class="return">
636
- <h3>Returns:</h3>
637
- <dl>
638
-
639
- <dt>
640
-
641
- <span class='type'>[<tt>Module</tt>]</span>
642
-
643
-
644
- <span class='name'></span>
645
-
646
-
647
- </dt>
648
- <dd>
649
- <span class='desc'><p>
650
- The newly configured project module.
651
- </p>
652
- </span>
653
- </dd>
654
-
655
- </dl>
656
- </div>
657
-
658
- </div><div class="section source">
659
- <span>[<a class="source_link" href="#">View source</a>]</span>
660
- <div class="source_code">
661
- <table>
662
- <tr>
663
- <td>
664
- <pre class="lines">
665
-
666
-
667
- 87
668
- 88
669
- 89
670
- 90
671
- 91
672
- 92
673
- 93
674
- 94
675
- 95
676
- 96
677
- 97
678
- 98
679
- 99
680
- 100
681
- 101
682
- 102
683
- 103
684
- 104
685
- 105
686
- 106
687
- 107
688
- 108
689
- 109
690
- 110
691
- 111
692
- 112
693
- 113
694
- 114
695
- 115
696
- 116
697
- 117
698
- 118
699
- 119
700
- 120
701
- 121
702
- 122
703
- 123
704
- 124
705
- 125
706
- 126
707
- 127
708
- 128
709
- 129
710
- 130
711
- 131
712
- 132
713
- 133
714
- 134
715
- 135</pre>
716
- </td>
717
- <td>
718
- <pre class="code"><span class="info file"># File 'lib/inochi/init.rb', line 87</span>
719
-
720
- <span class='def def kw'>def</span> <span class='init identifier id'>init</span> <span class='project_symbol identifier id'>project_symbol</span><span class='comma token'>,</span> <span class='project_config identifier id'>project_config</span> <span class='assign token'>=</span> <span class='semicolon token'>;</span><span class='lbrace token'>{</span><span class='rbrace token'>}</span>
721
- <span class='project_module identifier id'>project_module</span> <span class='assign token'>=</span> <span class='fetch_project_module identifier id'>fetch_project_module</span><span class='lparen token'>(</span><span class='project_symbol identifier id'>project_symbol</span><span class='rparen token'>)</span>
722
-
723
- <span class='comment val'># this method is not re-entrant</span>
724
- <span class='@already_seen ivar id'>@already_seen</span> <span class='opasgn op'>||=</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span>
725
- <span class='return return kw'>return</span> <span class='project_module identifier id'>project_module</span> <span class='if if_mod kw'>if</span> <span class='@already_seen ivar id'>@already_seen</span><span class='dot token'>.</span><span class='include? fid id'>include?</span> <span class='project_module identifier id'>project_module</span>
726
- <span class='@already_seen ivar id'>@already_seen</span> <span class='lshft op'>&lt;&lt;</span> <span class='project_module identifier id'>project_module</span>
727
-
728
- <span class='comment val'># put project on Ruby load path</span>
729
- <span class='project_file identifier id'>project_file</span> <span class='assign token'>=</span> <span class='File constant id'>File</span><span class='dot token'>.</span><span class='expand_path identifier id'>expand_path</span><span class='lparen token'>(</span><span class='first_caller_file identifier id'>first_caller_file</span><span class='rparen token'>)</span>
730
- <span class='project_libs identifier id'>project_libs</span> <span class='assign token'>=</span> <span class='File constant id'>File</span><span class='dot token'>.</span><span class='dirname identifier id'>dirname</span><span class='lparen token'>(</span><span class='project_file identifier id'>project_file</span><span class='rparen token'>)</span>
731
- <span class='$LOAD_PATH gvar id'>$LOAD_PATH</span> <span class='lshft op'>&lt;&lt;</span> <span class='project_libs identifier id'>project_libs</span> <span class='unless unless_mod kw'>unless</span> <span class='$LOAD_PATH gvar id'>$LOAD_PATH</span><span class='dot token'>.</span><span class='include? fid id'>include?</span> <span class='project_libs identifier id'>project_libs</span>
732
-
733
- <span class='comment val'># supply configuration defaults</span>
734
- <span class='project_config identifier id'>project_config</span><span class='lbrack token'>[</span><span class='symbol val'>:project</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='project_symbol identifier id'>project_symbol</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span>
735
- <span class='project_config identifier id'>project_config</span><span class='lbrack token'>[</span><span class='symbol val'>:tagline</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='string val'>''</span>
736
- <span class='project_config identifier id'>project_config</span><span class='lbrack token'>[</span><span class='symbol val'>:version</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='string val'>'0.0.0'</span>
737
- <span class='project_config identifier id'>project_config</span><span class='lbrack token'>[</span><span class='symbol val'>:release</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='Time constant id'>Time</span><span class='dot token'>.</span><span class='now identifier id'>now</span><span class='dot token'>.</span><span class='strftime identifier id'>strftime</span><span class='lparen token'>(</span><span class='string val'>'%F'</span><span class='rparen token'>)</span>
738
- <span class='project_config identifier id'>project_config</span><span class='lbrack token'>[</span><span class='symbol val'>:website</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='string val'>''</span>
739
- <span class='project_config identifier id'>project_config</span><span class='lbrack token'>[</span><span class='symbol val'>:docsite</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='project_config identifier id'>project_config</span><span class='lbrack token'>[</span><span class='symbol val'>:website</span><span class='rbrack token'>]</span>
740
- <span class='project_config identifier id'>project_config</span><span class='lbrack token'>[</span><span class='symbol val'>:display</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='dstring node'>&quot;#{project_config[:project]} #{project_config[:version]}&quot;</span>
741
- <span class='project_config identifier id'>project_config</span><span class='lbrack token'>[</span><span class='symbol val'>:program</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='calc_program_name identifier id'>calc_program_name</span><span class='lparen token'>(</span><span class='project_symbol identifier id'>project_symbol</span><span class='rparen token'>)</span>
742
- <span class='project_config identifier id'>project_config</span><span class='lbrack token'>[</span><span class='symbol val'>:install</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='File constant id'>File</span><span class='dot token'>.</span><span class='dirname identifier id'>dirname</span><span class='lparen token'>(</span><span class='project_libs identifier id'>project_libs</span><span class='rparen token'>)</span>
743
- <span class='project_config identifier id'>project_config</span><span class='lbrack token'>[</span><span class='symbol val'>:require</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span>
744
-
745
- <span class='comment val'># establish gem version dependencies and</span>
746
- <span class='comment val'># sanitize the values while we're at it</span>
747
- <span class='src identifier id'>src</span> <span class='assign token'>=</span> <span class='project_config identifier id'>project_config</span><span class='lbrack token'>[</span><span class='symbol val'>:require</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='dup identifier id'>dup</span>
748
- <span class='dst identifier id'>dst</span> <span class='assign token'>=</span> <span class='project_config identifier id'>project_config</span><span class='lbrack token'>[</span><span class='symbol val'>:require</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='clear identifier id'>clear</span>
749
-
750
- <span class='src identifier id'>src</span><span class='dot token'>.</span><span class='each_pair identifier id'>each_pair</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='gem_name identifier id'>gem_name</span><span class='comma token'>,</span> <span class='version_reqs identifier id'>version_reqs</span><span class='bitor op'>|</span>
751
- <span class='gem_name identifier id'>gem_name</span> <span class='assign token'>=</span> <span class='gem_name identifier id'>gem_name</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span>
752
- <span class='version_reqs identifier id'>version_reqs</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='version_reqs identifier id'>version_reqs</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='flatten identifier id'>flatten</span><span class='dot token'>.</span><span class='compact identifier id'>compact</span>
753
-
754
- <span class='dst identifier id'>dst</span><span class='lbrack token'>[</span><span class='gem_name identifier id'>gem_name</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='version_reqs identifier id'>version_reqs</span>
755
- <span class='gem identifier id'>gem</span> <span class='gem_name identifier id'>gem_name</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='version_reqs identifier id'>version_reqs</span>
756
- <span class='end end kw'>end</span>
757
-
758
- <span class='comment val'># make configuration parameters available as constants</span>
759
- <span class='project_config identifier id'>project_config</span><span class='lbrack token'>[</span><span class='symbol val'>:inochi</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='project_config identifier id'>project_config</span>
760
- <span class='project_config identifier id'>project_config</span><span class='lbrack token'>[</span><span class='symbol val'>:phrases</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='Phrases constant id'>Phrases</span><span class='dot token'>.</span><span class='new identifier id'>new</span> <span class='project_config identifier id'>project_config</span><span class='lbrack token'>[</span><span class='symbol val'>:install</span><span class='rbrack token'>]</span>
761
- <span class='project_config identifier id'>project_config</span><span class='lbrack token'>[</span><span class='symbol val'>:version</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='extend identifier id'>extend</span> <span class='Version constant id'>Version</span>
762
-
763
- <span class='project_config identifier id'>project_config</span><span class='dot token'>.</span><span class='each_pair identifier id'>each_pair</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='param identifier id'>param</span><span class='comma token'>,</span> <span class='value identifier id'>value</span><span class='bitor op'>|</span>
764
- <span class='project_module identifier id'>project_module</span><span class='dot token'>.</span><span class='const_set identifier id'>const_set</span> <span class='param identifier id'>param</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span><span class='dot token'>.</span><span class='upcase identifier id'>upcase</span><span class='comma token'>,</span> <span class='value identifier id'>value</span>
765
- <span class='end end kw'>end</span>
766
-
767
- <span class='project_module identifier id'>project_module</span>
768
- <span class='end end kw'>end</span>
769
- </pre>
770
- </td>
771
- </tr>
772
- </table>
773
- </div>
774
- </div>
775
- </div>
776
- </div>
777
-
778
- <div class="method">
779
- <div class="method_header">
780
- <h3>main</h3>
781
- </div><div id="main-class_method" class="section method">
782
- <div class="details_title">
783
- <div class='section methodsignature'>
784
- <tt class='def'>
785
- <span class='visibility'>public</span>
786
- <span class='return_types'></span>
787
- <span class='name'>main</span><span class='args'>(project_symbol, *trollop_args, &amp;trollop_config)</span>
788
- <span class='block'></span>
789
- </tt>
790
- </div>
791
-
792
- </div><div class="section docstring">
793
- <p>
794
- Provides a common configuration for the main project executable:
795
- </p>
796
- <ul>
797
- <li>The program description (the sequence of non-blank lines at the top of the
798
- file in which this method is invoked) is properly formatted and displayed
799
- at the top of program&#8217;s help information.
800
-
801
- </li>
802
- <li>The program version information is fetched from the project module and
803
- formatted in YAML fashion for easy consumption by other tools.
804
-
805
- </li>
806
- <li>A list of command-line options is displayed at the bottom of the
807
- program&#8217;s help information.
808
-
809
- </li>
810
- </ul>
811
- <p>
812
- It is assumed that this method is invoked from only within the main project
813
- executable (in the project bin/ directory).
814
- </p>
815
-
816
- </div><div class="section tags">
817
- <h2>Meta Tags</h2>
818
- <div class="param">
819
- <h3>Parameters:</h3>
820
- <dl>
821
-
822
-
823
- <dt>
824
- <span class='type'>[<tt>Symbol</tt>]</span>
825
- <span class='name'>project_symbol</span>
826
-
827
- </dt>
828
- <dd>
829
- <span class='desc'><p>
830
- Name of the Ruby constant which serves as a namespace for the entire
831
- project.
832
- </p>
833
- </span>
834
- </dd>
835
-
836
-
837
- </dl>
838
- </div><div class="return">
839
- <h3>Returns:</h3>
840
- <dl>
841
-
842
- <dt>
843
-
844
- <span class='type'>[<tt>Object</tt>]</span>
845
-
846
-
847
- <span class='name'></span>
848
-
849
-
850
- </dt>
851
- <dd>
852
- <span class='desc'><p>
853
- The result of Trollop::options().
854
- </p>
855
- </span>
856
- </dd>
857
-
858
- </dl>
859
- </div>
860
-
861
- </div><div class="section source">
862
- <span>[<a class="source_link" href="#">View source</a>]</span>
863
- <div class="source_code">
864
- <table>
865
- <tr>
866
- <td>
867
- <pre class="lines">
868
-
869
-
870
- 29
871
- 30
872
- 31
873
- 32
874
- 33
875
- 34
876
- 35
877
- 36
878
- 37
879
- 38
880
- 39
881
- 40
882
- 41
883
- 42
884
- 43
885
- 44
886
- 45
887
- 46
888
- 47
889
- 48
890
- 49
891
- 50
892
- 51
893
- 52
894
- 53
895
- 54
896
- 55
897
- 56
898
- 57
899
- 58
900
- 59
901
- 60
902
- 61
903
- 62
904
- 63
905
- 64
906
- 65
907
- 66
908
- 67
909
- 68
910
- 69
911
- 70
912
- 71
913
- 72
914
- 73
915
- 74
916
- 75</pre>
917
- </td>
918
- <td>
919
- <pre class="code"><span class="info file"># File 'lib/inochi/main.rb', line 29</span>
920
-
921
- <span class='def def kw'>def</span> <span class='Inochi constant id'>Inochi</span><span class='dot token'>.</span><span class='main identifier id'>main</span> <span class='project_symbol identifier id'>project_symbol</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='trollop_args identifier id'>trollop_args</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='trollop_config identifier id'>trollop_config</span>
922
- <span class='program_file identifier id'>program_file</span> <span class='assign token'>=</span> <span class='first_caller_file identifier id'>first_caller_file</span>
923
- <span class='program_name identifier id'>program_name</span> <span class='assign token'>=</span> <span class='File constant id'>File</span><span class='dot token'>.</span><span class='basename identifier id'>basename</span><span class='lparen token'>(</span><span class='program_file identifier id'>program_file</span><span class='rparen token'>)</span>
924
- <span class='program_home identifier id'>program_home</span> <span class='assign token'>=</span> <span class='File constant id'>File</span><span class='dot token'>.</span><span class='dirname identifier id'>dirname</span><span class='lparen token'>(</span><span class='File constant id'>File</span><span class='dot token'>.</span><span class='dirname identifier id'>dirname</span><span class='lparen token'>(</span><span class='program_file identifier id'>program_file</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
925
-
926
- <span class='comment val'># load the project module</span>
927
- <span class='require identifier id'>require</span> <span class='File constant id'>File</span><span class='dot token'>.</span><span class='join identifier id'>join</span><span class='lparen token'>(</span><span class='program_home identifier id'>program_home</span><span class='comma token'>,</span> <span class='string val'>'lib'</span><span class='comma token'>,</span> <span class='program_name identifier id'>program_name</span><span class='rparen token'>)</span>
928
- <span class='project_module identifier id'>project_module</span> <span class='assign token'>=</span> <span class='fetch_project_module identifier id'>fetch_project_module</span><span class='lparen token'>(</span><span class='project_symbol identifier id'>project_symbol</span><span class='rparen token'>)</span>
929
-
930
- <span class='comment val'># parse command-line options</span>
931
- <span class='require identifier id'>require</span> <span class='string val'>'trollop'</span>
932
-
933
- <span class='options identifier id'>options</span> <span class='assign token'>=</span> <span class='Trollop constant id'>Trollop</span><span class='dot token'>.</span><span class='options identifier id'>options</span><span class='lparen token'>(</span><span class='mult op'>*</span><span class='trollop_args identifier id'>trollop_args</span><span class='rparen token'>)</span> <span class='do do kw'>do</span>
934
-
935
- <span class='comment val'># show project description</span>
936
- <span class='text identifier id'>text</span> <span class='dstring node'>&quot;#{project_module::PROJECT} - #{project_module::TAGLINE}&quot;</span>
937
- <span class='text identifier id'>text</span> <span class='string val'>''</span>
938
-
939
- <span class='comment val'># show program description</span>
940
- <span class='text identifier id'>text</span> <span class='File constant id'>File</span><span class='dot token'>.</span><span class='read identifier id'>read</span><span class='lparen token'>(</span><span class='program_file identifier id'>program_file</span><span class='rparen token'>)</span><span class='lbrack token'>[</span><span class='regexp val'>/\A.*?^$\n/</span><span class='m identifier id'>m</span><span class='rbrack token'>]</span><span class='dot token'>.</span> <span class='comment val'># grab the header</span>
941
- <span class='gsub identifier id'>gsub</span><span class='lparen token'>(</span><span class='regexp val'>/^# ?/</span><span class='comma token'>,</span> <span class='string val'>''</span><span class='rparen token'>)</span><span class='dot token'>.</span> <span class='comment val'># strip the comment markers</span>
942
- <span class='sub identifier id'>sub</span><span class='lparen token'>(</span><span class='regexp val'>/\A!.*?\n/</span><span class='comma token'>,</span> <span class='string val'>''</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='lstrip identifier id'>lstrip</span> <span class='comment val'># omit the shebang line</span>
943
- <span class='text identifier id'>text</span> <span class='string val'>''</span>
944
-
945
- <span class='instance_eval identifier id'>instance_eval</span><span class='lparen token'>(</span><span class='bitand op'>&amp;</span><span class='trollop_config identifier id'>trollop_config</span><span class='rparen token'>)</span> <span class='if if_mod kw'>if</span> <span class='trollop_config identifier id'>trollop_config</span>
946
-
947
- <span class='comment val'># show version information</span>
948
- <span class='version identifier id'>version</span> <span class='dstring node'>%w[PROJECT VERSION RELEASE WEBSITE INSTALL]</span><span class='dot token'>.</span><span class='map identifier id'>map</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='c identifier id'>c</span><span class='bitor op'>|</span>
949
- <span class='dstring node'>&quot;#{c.downcase}: #{project_module.const_get c}&quot;</span>
950
- <span class='rbrace token'>}</span><span class='dot token'>.</span><span class='join identifier id'>join</span><span class='lparen token'>(</span><span class='string val'>&quot;\n&quot;</span><span class='rparen token'>)</span>
951
-
952
- <span class='opt identifier id'>opt</span> <span class='symbol val'>:manual</span><span class='comma token'>,</span> <span class='string val'>'Show the user manual'</span>
953
- <span class='opt identifier id'>opt</span> <span class='symbol val'>:locale</span><span class='comma token'>,</span> <span class='string val'>'Set preferred language'</span><span class='comma token'>,</span> <span class='symbol val'>:type</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='symbol val'>:string</span>
954
- <span class='end end kw'>end</span>
955
-
956
- <span class='if if kw'>if</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='colon op'>:</span><span class='manual identifier id'>manual</span><span class='rbrack token'>]</span>
957
- <span class='require identifier id'>require</span> <span class='string val'>'launchy'</span>
958
- <span class='Launchy constant id'>Launchy</span><span class='colon2 op'>::</span><span class='Browser constant id'>Browser</span><span class='dot token'>.</span><span class='run identifier id'>run</span> <span class='dstring node'>&quot;#{project_module::INSTALL}/doc/index.xhtml&quot;</span>
959
- <span class='exit identifier id'>exit</span>
960
- <span class='end end kw'>end</span>
961
-
962
- <span class='if if kw'>if</span> <span class='locale identifier id'>locale</span> <span class='assign token'>=</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='colon op'>:</span><span class='locale identifier id'>locale</span><span class='rbrack token'>]</span>
963
- <span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='PHRASES constant id'>PHRASES</span><span class='dot token'>.</span><span class='locale identifier id'>locale</span> <span class='assign token'>=</span> <span class='locale identifier id'>locale</span>
964
- <span class='end end kw'>end</span>
965
-
966
- <span class='options identifier id'>options</span>
967
- <span class='end end kw'>end</span>
968
- </pre>
969
- </td>
970
- </tr>
971
- </table>
972
- </div>
973
- </div>
974
- </div>
975
- </div>
976
-
977
- <div class="method">
978
- <div class="method_header">
979
- <h3>rake</h3>
980
- </div><div id="rake-class_method" class="section method">
981
- <div class="details_title">
982
- <div class='section methodsignature'>
983
- <tt class='def'>
984
- <span class='visibility'>public</span>
985
- <span class='return_types'></span>
986
- <span class='name'>rake</span><span class='args'>(project_symbol, options = )</span>
987
- <span class='block'>{|gem_spec| ... }</span>
988
- </tt>
989
- </div>
990
-
991
- </div><div class="section docstring">
992
- <p>
993
- Provides Rake tasks for packaging, publishing, and announcing your project.
994
- </p>
995
- <ul>
996
- <li>An AUTHORS constant (which has the form &quot;[[name, info]]&quot; where
997
- &quot;name&quot; is the name of a copyright holder and &quot;info&quot; is
998
- their contact information) is added to the project module.
999
-
1000
- <p>
1001
- Unless this information is supplied via the :authors option, it is
1002
- automatically extracted from copyright notices in the project license file,
1003
- where the first copyright notice is expected to correspond to the primary
1004
- project maintainer.
1005
- </p>
1006
- <p>
1007
- Copyright notices must be in the following form:
1008
- </p>
1009
- <pre class="code">
1010
- <span class='Copyright constant id'>Copyright</span> <span class='YEAR constant id'>YEAR</span> <span class='HOLDER constant id'>HOLDER</span> <span class='lt op'>&lt;</span><span class='EMAIL constant id'>EMAIL</span><span class='gt op'>&gt;</span>
1011
- </pre>
1012
- <p>
1013
- Where HOLDER is the name of the copyright holder, YEAR is the year when the
1014
- copyright holder first began working on the project, and EMAIL is
1015
- (optional) the email address of the copyright holder.
1016
- </p>
1017
- </li>
1018
- </ul>
1019
-
1020
- </div><div class="section tags">
1021
- <h2>Meta Tags</h2>
1022
- <div class="param">
1023
- <h3>Parameters:</h3>
1024
- <dl>
1025
-
1026
-
1027
- <dt>
1028
- <span class='type'>[<tt>Symbol</tt>]</span>
1029
- <span class='name'>project_symbol</span>
1030
-
1031
- </dt>
1032
- <dd>
1033
- <span class='desc'><p>
1034
- Name of the Ruby constant which serves as a namespace for the entire
1035
- project.
1036
- </p>
1037
- </span>
1038
- </dd>
1039
-
1040
-
1041
-
1042
- <dt>
1043
- <span class='type'>[<tt>Hash</tt>]</span>
1044
- <span class='name'>options</span>
1045
-
1046
- <em class="default">(defaults to: <tt></tt>)</em>
1047
-
1048
- </dt>
1049
- <dd>
1050
- <span class='desc'><p>
1051
- Additional method parameters, which are all optional:
1052
- </p>
1053
- <dl>
1054
- <dt>Array</dt><dd>:authors =&gt; A list of project authors and their contact information.
1055
- This list must have the form &quot;[[name, info]]&quot; where
1056
- &quot;name&quot; is the name of a project author and &quot;info&quot; is
1057
- their contact information.
1058
-
1059
- </dd>
1060
- <dt>String</dt><dd>:license_file =&gt; Path (relative to the main project directory which
1061
- contains the project Rakefile) to the file which contains the project
1062
- license.
1063
-
1064
- </dd>
1065
- </dl>
1066
- <p>
1067
- The default value is &quot;LICENSE&quot;.
1068
- </p>
1069
- <dl>
1070
- <dt>String</dt><dd>:logins_file =&gt; Path to the YAML file which contains login information
1071
- for publishing release announcements.
1072
-
1073
- </dd>
1074
- </dl>
1075
- <p>
1076
- The default value is &quot;~/.config/inochi/logins.yaml&quot; where
1077
- &quot;~&quot; is the path to your home directory.
1078
- </p>
1079
- <dl>
1080
- <dt>String</dt><dd>:rubyforge_project =&gt; Name of the RubyForge project where release
1081
- packages will be published.
1082
-
1083
- </dd>
1084
- </dl>
1085
- <p>
1086
- The default value is the value of the PROGRAM constant.
1087
- </p>
1088
- <dl>
1089
- <dt>String</dt><dd>:rubyforge_section =&gt; Name of the RubyForge project&#8217;s File Release
1090
- System section where release packages will be published.
1091
-
1092
- </dd>
1093
- </dl>
1094
- <p>
1095
- The default value is the value of the :rubyforge_project parameter.
1096
- </p>
1097
- <dl>
1098
- <dt>String</dt><dd>:raa_project =&gt; Name of the RAA (Ruby Application Archive) entry for
1099
- this project.
1100
-
1101
- </dd>
1102
- </dl>
1103
- <p>
1104
- The default value is the value of the PROGRAM constant.
1105
- </p>
1106
- <dl>
1107
- <dt>String</dt><dd>:upload_target =&gt; Where to upload the project documentation. See
1108
- &quot;destination&quot; in the rsync manual.
1109
-
1110
- </dd>
1111
- </dl>
1112
- <p>
1113
- The default value is nil.
1114
- </p>
1115
- <dl>
1116
- <dt>String</dt><dd>:upload_delete =&gt; Delete unknown files at the upload target location?
1117
-
1118
- </dd>
1119
- </dl>
1120
- <p>
1121
- The default value is false.
1122
- </p>
1123
- <dl>
1124
- <dt>Array</dt><dd>:upload_options =&gt; Additional command-line arguments to the rsync
1125
- command.
1126
-
1127
- </dd>
1128
- </dl>
1129
- <p>
1130
- The default value is an empty array.
1131
- </p>
1132
- </span>
1133
- </dd>
1134
-
1135
-
1136
- </dl>
1137
- </div><div class="yieldparam">
1138
- <h3>Yield Parameters:</h3>
1139
- <dl>
1140
-
1141
- <dt>
1142
-
1143
- <span class='type'>[<tt>Gem::Specification</tt>]</span>
1144
-
1145
-
1146
- <span class='name'>gem_spec</span>
1147
-
1148
-
1149
- </dt>
1150
- <dd>
1151
- <span class='desc'><p>
1152
- the gem specification
1153
- </p>
1154
- </span>
1155
- </dd>
1156
-
1157
- </dl>
1158
- </div>
1159
-
1160
- </div><div class="section source">
1161
- <span>[<a class="source_link" href="#">View source</a>]</span>
1162
- <div class="source_code">
1163
- <table>
1164
- <tr>
1165
- <td>
1166
- <pre class="lines">
1167
-
1168
-
1169
- 85
1170
- 86
1171
- 87
1172
- 88
1173
- 89
1174
- 90
1175
- 91
1176
- 92
1177
- 93
1178
- 94
1179
- 95
1180
- 96
1181
- 97
1182
- 98
1183
- 99
1184
- 100
1185
- 101
1186
- 102
1187
- 103
1188
- 104
1189
- 105
1190
- 106
1191
- 107
1192
- 108
1193
- 109
1194
- 110
1195
- 111
1196
- 112
1197
- 113
1198
- 114
1199
- 115
1200
- 116
1201
- 117
1202
- 118
1203
- 119
1204
- 120
1205
- 121
1206
- 122
1207
- 123
1208
- 124
1209
- 125
1210
- 126
1211
- 127
1212
- 128
1213
- 129
1214
- 130
1215
- 131
1216
- 132
1217
- 133
1218
- 134
1219
- 135
1220
- 136
1221
- 137
1222
- 138
1223
- 139
1224
- 140
1225
- 141
1226
- 142
1227
- 143
1228
- 144
1229
- 145
1230
- 146
1231
- 147
1232
- 148
1233
- 149
1234
- 150
1235
- 151
1236
- 152
1237
- 153
1238
- 154
1239
- 155
1240
- 156
1241
- 157
1242
- 158
1243
- 159
1244
- 160
1245
- 161
1246
- 162
1247
- 163
1248
- 164
1249
- 165
1250
- 166
1251
- 167
1252
- 168
1253
- 169
1254
- 170
1255
- 171
1256
- 172
1257
- 173
1258
- 174
1259
- 175
1260
- 176
1261
- 177
1262
- 178
1263
- 179
1264
- 180
1265
- 181
1266
- 182
1267
- 183
1268
- 184
1269
- 185
1270
- 186
1271
- 187
1272
- 188
1273
- 189
1274
- 190
1275
- 191
1276
- 192
1277
- 193
1278
- 194
1279
- 195
1280
- 196
1281
- 197
1282
- 198
1283
- 199
1284
- 200
1285
- 201
1286
- 202
1287
- 203
1288
- 204
1289
- 205
1290
- 206
1291
- 207
1292
- 208
1293
- 209
1294
- 210
1295
- 211
1296
- 212
1297
- 213
1298
- 214
1299
- 215
1300
- 216
1301
- 217
1302
- 218
1303
- 219
1304
- 220
1305
- 221
1306
- 222
1307
- 223
1308
- 224
1309
- 225
1310
- 226
1311
- 227
1312
- 228
1313
- 229
1314
- 230
1315
- 231
1316
- 232
1317
- 233
1318
- 234
1319
- 235
1320
- 236
1321
- 237
1322
- 238
1323
- 239
1324
- 240
1325
- 241
1326
- 242
1327
- 243
1328
- 244
1329
- 245
1330
- 246
1331
- 247
1332
- 248
1333
- 249
1334
- 250
1335
- 251
1336
- 252
1337
- 253
1338
- 254
1339
- 255
1340
- 256
1341
- 257
1342
- 258
1343
- 259
1344
- 260
1345
- 261
1346
- 262
1347
- 263
1348
- 264
1349
- 265
1350
- 266
1351
- 267
1352
- 268
1353
- 269
1354
- 270
1355
- 271
1356
- 272
1357
- 273
1358
- 274
1359
- 275
1360
- 276
1361
- 277
1362
- 278
1363
- 279
1364
- 280
1365
- 281
1366
- 282
1367
- 283
1368
- 284
1369
- 285
1370
- 286
1371
- 287
1372
- 288
1373
- 289
1374
- 290
1375
- 291
1376
- 292
1377
- 293
1378
- 294
1379
- 295
1380
- 296
1381
- 297
1382
- 298
1383
- 299
1384
- 300
1385
- 301
1386
- 302
1387
- 303
1388
- 304
1389
- 305
1390
- 306
1391
- 307
1392
- 308
1393
- 309
1394
- 310
1395
- 311
1396
- 312
1397
- 313
1398
- 314
1399
- 315
1400
- 316
1401
- 317
1402
- 318
1403
- 319
1404
- 320
1405
- 321
1406
- 322
1407
- 323
1408
- 324
1409
- 325
1410
- 326
1411
- 327
1412
- 328
1413
- 329
1414
- 330
1415
- 331
1416
- 332
1417
- 333
1418
- 334
1419
- 335
1420
- 336
1421
- 337
1422
- 338
1423
- 339
1424
- 340
1425
- 341
1426
- 342
1427
- 343
1428
- 344
1429
- 345
1430
- 346
1431
- 347
1432
- 348
1433
- 349
1434
- 350
1435
- 351
1436
- 352
1437
- 353
1438
- 354
1439
- 355
1440
- 356
1441
- 357
1442
- 358
1443
- 359
1444
- 360
1445
- 361
1446
- 362
1447
- 363
1448
- 364
1449
- 365
1450
- 366
1451
- 367
1452
- 368
1453
- 369
1454
- 370
1455
- 371
1456
- 372
1457
- 373
1458
- 374
1459
- 375
1460
- 376
1461
- 377
1462
- 378
1463
- 379
1464
- 380
1465
- 381
1466
- 382
1467
- 383
1468
- 384
1469
- 385
1470
- 386
1471
- 387
1472
- 388
1473
- 389
1474
- 390
1475
- 391
1476
- 392
1477
- 393
1478
- 394
1479
- 395
1480
- 396
1481
- 397
1482
- 398
1483
- 399
1484
- 400
1485
- 401
1486
- 402
1487
- 403
1488
- 404
1489
- 405
1490
- 406
1491
- 407
1492
- 408
1493
- 409
1494
- 410
1495
- 411
1496
- 412
1497
- 413
1498
- 414
1499
- 415
1500
- 416
1501
- 417
1502
- 418
1503
- 419
1504
- 420
1505
- 421
1506
- 422
1507
- 423
1508
- 424
1509
- 425
1510
- 426
1511
- 427
1512
- 428
1513
- 429
1514
- 430
1515
- 431
1516
- 432
1517
- 433
1518
- 434
1519
- 435
1520
- 436
1521
- 437
1522
- 438
1523
- 439
1524
- 440
1525
- 441
1526
- 442
1527
- 443
1528
- 444
1529
- 445
1530
- 446
1531
- 447
1532
- 448
1533
- 449
1534
- 450
1535
- 451
1536
- 452
1537
- 453
1538
- 454
1539
- 455
1540
- 456
1541
- 457
1542
- 458
1543
- 459
1544
- 460
1545
- 461
1546
- 462
1547
- 463
1548
- 464
1549
- 465
1550
- 466
1551
- 467
1552
- 468
1553
- 469
1554
- 470
1555
- 471
1556
- 472
1557
- 473
1558
- 474
1559
- 475
1560
- 476
1561
- 477
1562
- 478
1563
- 479
1564
- 480
1565
- 481
1566
- 482
1567
- 483
1568
- 484
1569
- 485
1570
- 486
1571
- 487
1572
- 488
1573
- 489
1574
- 490
1575
- 491
1576
- 492
1577
- 493
1578
- 494
1579
- 495
1580
- 496
1581
- 497
1582
- 498
1583
- 499
1584
- 500
1585
- 501
1586
- 502
1587
- 503
1588
- 504
1589
- 505
1590
- 506
1591
- 507
1592
- 508
1593
- 509
1594
- 510
1595
- 511
1596
- 512
1597
- 513
1598
- 514
1599
- 515
1600
- 516
1601
- 517
1602
- 518
1603
- 519
1604
- 520
1605
- 521
1606
- 522
1607
- 523
1608
- 524
1609
- 525
1610
- 526
1611
- 527
1612
- 528
1613
- 529
1614
- 530
1615
- 531
1616
- 532
1617
- 533
1618
- 534
1619
- 535
1620
- 536
1621
- 537
1622
- 538
1623
- 539
1624
- 540
1625
- 541
1626
- 542
1627
- 543
1628
- 544
1629
- 545
1630
- 546
1631
- 547
1632
- 548
1633
- 549
1634
- 550
1635
- 551
1636
- 552
1637
- 553
1638
- 554
1639
- 555
1640
- 556
1641
- 557
1642
- 558
1643
- 559
1644
- 560
1645
- 561
1646
- 562
1647
- 563
1648
- 564
1649
- 565
1650
- 566
1651
- 567
1652
- 568
1653
- 569
1654
- 570
1655
- 571
1656
- 572
1657
- 573
1658
- 574
1659
- 575
1660
- 576
1661
- 577
1662
- 578
1663
- 579
1664
- 580
1665
- 581
1666
- 582
1667
- 583
1668
- 584
1669
- 585
1670
- 586
1671
- 587
1672
- 588
1673
- 589
1674
- 590
1675
- 591
1676
- 592
1677
- 593
1678
- 594
1679
- 595
1680
- 596
1681
- 597
1682
- 598
1683
- 599
1684
- 600
1685
- 601
1686
- 602
1687
- 603
1688
- 604
1689
- 605
1690
- 606
1691
- 607
1692
- 608
1693
- 609
1694
- 610
1695
- 611
1696
- 612
1697
- 613
1698
- 614
1699
- 615
1700
- 616
1701
- 617
1702
- 618
1703
- 619
1704
- 620
1705
- 621
1706
- 622
1707
- 623
1708
- 624
1709
- 625
1710
- 626
1711
- 627
1712
- 628
1713
- 629
1714
- 630
1715
- 631
1716
- 632
1717
- 633
1718
- 634
1719
- 635
1720
- 636
1721
- 637
1722
- 638
1723
- 639
1724
- 640
1725
- 641
1726
- 642
1727
- 643
1728
- 644
1729
- 645
1730
- 646
1731
- 647
1732
- 648
1733
- 649
1734
- 650
1735
- 651
1736
- 652
1737
- 653
1738
- 654
1739
- 655
1740
- 656
1741
- 657
1742
- 658
1743
- 659
1744
- 660
1745
- 661
1746
- 662
1747
- 663
1748
- 664
1749
- 665
1750
- 666
1751
- 667
1752
- 668
1753
- 669
1754
- 670
1755
- 671
1756
- 672
1757
- 673
1758
- 674
1759
- 675
1760
- 676
1761
- 677
1762
- 678
1763
- 679
1764
- 680
1765
- 681
1766
- 682
1767
- 683
1768
- 684
1769
- 685
1770
- 686
1771
- 687
1772
- 688
1773
- 689
1774
- 690
1775
- 691
1776
- 692
1777
- 693
1778
- 694
1779
- 695
1780
- 696
1781
- 697
1782
- 698
1783
- 699
1784
- 700
1785
- 701
1786
- 702
1787
- 703
1788
- 704
1789
- 705
1790
- 706
1791
- 707
1792
- 708
1793
- 709
1794
- 710
1795
- 711
1796
- 712
1797
- 713
1798
- 714
1799
- 715
1800
- 716
1801
- 717
1802
- 718
1803
- 719
1804
- 720
1805
- 721
1806
- 722
1807
- 723
1808
- 724
1809
- 725
1810
- 726
1811
- 727
1812
- 728
1813
- 729
1814
- 730
1815
- 731
1816
- 732
1817
- 733
1818
- 734
1819
- 735
1820
- 736
1821
- 737
1822
- 738
1823
- 739
1824
- 740
1825
- 741
1826
- 742
1827
- 743
1828
- 744
1829
- 745
1830
- 746
1831
- 747
1832
- 748
1833
- 749
1834
- 750
1835
- 751
1836
- 752
1837
- 753
1838
- 754
1839
- 755
1840
- 756
1841
- 757
1842
- 758
1843
- 759
1844
- 760
1845
- 761
1846
- 762
1847
- 763
1848
- 764
1849
- 765
1850
- 766
1851
- 767
1852
- 768
1853
- 769
1854
- 770
1855
- 771
1856
- 772
1857
- 773
1858
- 774
1859
- 775
1860
- 776
1861
- 777</pre>
1862
- </td>
1863
- <td>
1864
- <pre class="code"><span class="info file"># File 'lib/inochi/rake.rb', line 85</span>
1865
-
1866
- <span class='def def kw'>def</span> <span class='Inochi constant id'>Inochi</span><span class='dot token'>.</span><span class='rake identifier id'>rake</span> <span class='project_symbol identifier id'>project_symbol</span><span class='comma token'>,</span> <span class='options identifier id'>options</span> <span class='assign token'>=</span> <span class='semicolon token'>;</span><span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='gem_config identifier id'>gem_config</span>
1867
- <span class='program_file identifier id'>program_file</span> <span class='assign token'>=</span> <span class='first_caller_file identifier id'>first_caller_file</span>
1868
- <span class='program_home identifier id'>program_home</span> <span class='assign token'>=</span> <span class='File constant id'>File</span><span class='dot token'>.</span><span class='dirname identifier id'>dirname</span><span class='lparen token'>(</span><span class='program_file identifier id'>program_file</span><span class='rparen token'>)</span>
1869
-
1870
- <span class='comment val'># load the project module</span>
1871
- <span class='program_name identifier id'>program_name</span> <span class='assign token'>=</span> <span class='File constant id'>File</span><span class='dot token'>.</span><span class='basename identifier id'>basename</span><span class='lparen token'>(</span><span class='program_home identifier id'>program_home</span><span class='rparen token'>)</span>
1872
- <span class='project_libs identifier id'>project_libs</span> <span class='assign token'>=</span> <span class='File constant id'>File</span><span class='dot token'>.</span><span class='join identifier id'>join</span><span class='lparen token'>(</span><span class='string val'>'lib'</span><span class='comma token'>,</span> <span class='program_name identifier id'>program_name</span><span class='rparen token'>)</span>
1873
-
1874
- <span class='require identifier id'>require</span> <span class='project_libs identifier id'>project_libs</span>
1875
- <span class='project_module identifier id'>project_module</span> <span class='assign token'>=</span> <span class='fetch_project_module identifier id'>fetch_project_module</span><span class='lparen token'>(</span><span class='project_symbol identifier id'>project_symbol</span><span class='rparen token'>)</span>
1876
-
1877
- <span class='comment val'># supply default options</span>
1878
- <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:rubyforge_project</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='program_name identifier id'>program_name</span>
1879
- <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:rubyforge_section</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='program_name identifier id'>program_name</span>
1880
- <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:raa_project</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='program_name identifier id'>program_name</span>
1881
-
1882
- <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:license_file</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='string val'>'LICENSE'</span>
1883
- <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:logins_file</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='File constant id'>File</span><span class='dot token'>.</span><span class='join identifier id'>join</span><span class='lparen token'>(</span>
1884
- <span class='ENV constant id'>ENV</span><span class='lbrack token'>[</span><span class='string val'>'HOME'</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='ENV constant id'>ENV</span><span class='lbrack token'>[</span><span class='string val'>'USERPROFILE'</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='string val'>'.'</span><span class='comma token'>,</span>
1885
- <span class='string val'>'.config'</span><span class='comma token'>,</span> <span class='string val'>'inochi'</span><span class='comma token'>,</span> <span class='string val'>'logins.yaml'</span>
1886
- <span class='rparen token'>)</span>
1887
-
1888
- <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:upload_delete</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='false false kw'>false</span>
1889
- <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:upload_options</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span>
1890
-
1891
- <span class='comment val'># add AUTHORS constant to the project module</span>
1892
- <span class='copyright_holders identifier id'>copyright_holders</span> <span class='assign token'>=</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:authors</span><span class='rbrack token'>]</span> <span class='orop op'>||</span>
1893
- <span class='File constant id'>File</span><span class='dot token'>.</span><span class='read identifier id'>read</span><span class='lparen token'>(</span><span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:license_file</span><span class='rbrack token'>]</span><span class='rparen token'>)</span><span class='dot token'>.</span>
1894
- <span class='scan identifier id'>scan</span><span class='lparen token'>(</span><span class='regexp val'>/Copyright.*?\d+\s+(.*)/</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='flatten identifier id'>flatten</span><span class='dot token'>.</span>
1895
- <span class='map identifier id'>map</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='s identifier id'>s</span><span class='bitor op'>|</span> <span class='lparen token'>(</span><span class='s identifier id'>s</span> <span class='match op'>=~</span> <span class='regexp val'>/\s*&lt;(.*?)&gt;/</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='lbrack token'>[</span><span class='$` back_ref id'>$`</span><span class='comma token'>,</span> <span class='$1 nth_ref id'>$1</span><span class='rbrack token'>]</span> <span class='colon op'>:</span> <span class='lbrack token'>[</span><span class='s identifier id'>s</span><span class='comma token'>,</span> <span class='string val'>''</span><span class='rbrack token'>]</span> <span class='rbrace token'>}</span>
1896
-
1897
- <span class='project_module identifier id'>project_module</span><span class='dot token'>.</span><span class='const_set identifier id'>const_set</span> <span class='symbol val'>:AUTHORS</span><span class='comma token'>,</span> <span class='copyright_holders identifier id'>copyright_holders</span>
1898
-
1899
- <span class='require identifier id'>require</span> <span class='string val'>'rake/clean'</span>
1900
-
1901
- <span class='hide_rake_task identifier id'>hide_rake_task</span> <span class='assign token'>=</span> <span class='lambda identifier id'>lambda</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='name identifier id'>name</span><span class='bitor op'>|</span>
1902
- <span class='Rake constant id'>Rake</span><span class='colon2 op'>::</span><span class='Task constant id'>Task</span><span class='lbrack token'>[</span><span class='name identifier id'>name</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='instance_variable_set identifier id'>instance_variable_set</span> <span class='symbol val'>:@comment</span><span class='comma token'>,</span> <span class='nil nil kw'>nil</span>
1903
- <span class='end end kw'>end</span>
1904
-
1905
- <span class='comment val'># translation</span>
1906
- <span class='directory identifier id'>directory</span> <span class='string val'>'lang'</span>
1907
-
1908
- <span class='lang_dump_deps identifier id'>lang_dump_deps</span> <span class='assign token'>=</span> <span class='string val'>'lang'</span>
1909
- <span class='lang_dump_file identifier id'>lang_dump_file</span> <span class='assign token'>=</span> <span class='string val'>'lang/phrases.yaml'</span>
1910
-
1911
- <span class='desc identifier id'>desc</span> <span class='string val'>'Extract language phrases for translation.'</span>
1912
- <span class='task identifier id'>task</span> <span class='string val'>'lang:dump'</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='lang_dump_file identifier id'>lang_dump_file</span>
1913
-
1914
- <span class='file identifier id'>file</span> <span class='lang_dump_file identifier id'>lang_dump_file</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='lang_dump_deps identifier id'>lang_dump_deps</span> <span class='do do kw'>do</span>
1915
- <span class='ENV constant id'>ENV</span><span class='lbrack token'>[</span><span class='string val'>'dump_lang_phrases'</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='string val'>'1'</span>
1916
- <span class='Rake constant id'>Rake</span><span class='colon2 op'>::</span><span class='Task constant id'>Task</span><span class='lbrack token'>[</span><span class='symbol val'>:test</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='invoke identifier id'>invoke</span>
1917
- <span class='end end kw'>end</span>
1918
-
1919
- <span class='lang_conv_delim identifier id'>lang_conv_delim</span> <span class='assign token'>=</span> <span class='string val'>&quot;\n&quot;</span> <span class='mult op'>*</span> <span class='integer val'>5</span>
1920
-
1921
- <span class='desc identifier id'>desc</span> <span class='string val'>'Translate extracted language phrases (from=LANGUAGE_CODE).'</span>
1922
- <span class='task identifier id'>task</span> <span class='string val'>'lang:conv'</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='lang_dump_file identifier id'>lang_dump_file</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='t identifier id'>t</span><span class='bitor op'>|</span>
1923
- <span class='require identifier id'>require</span> <span class='string val'>'babelfish'</span>
1924
-
1925
- <span class='unless unless kw'>unless</span>
1926
- <span class='src_lang identifier id'>src_lang</span> <span class='assign token'>=</span> <span class='ENV constant id'>ENV</span><span class='lbrack token'>[</span><span class='string val'>'from'</span><span class='rbrack token'>]</span> <span class='and and kw'>and</span>
1927
- <span class='BabelFish constant id'>BabelFish</span><span class='colon2 op'>::</span><span class='LANGUAGE_CODES constant id'>LANGUAGE_CODES</span><span class='dot token'>.</span><span class='include? fid id'>include?</span> <span class='src_lang identifier id'>src_lang</span>
1928
- <span class='then then kw'>then</span>
1929
- <span class='message identifier id'>message</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='string val'>'The &quot;from&quot; parameter must be specified as follows:'</span><span class='rbrack token'>]</span>
1930
-
1931
- <span class='BabelFish constant id'>BabelFish</span><span class='colon2 op'>::</span><span class='LANGUAGE_CODES constant id'>LANGUAGE_CODES</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='c identifier id'>c</span><span class='bitor op'>|</span>
1932
- <span class='n identifier id'>n</span> <span class='assign token'>=</span> <span class='BabelFish constant id'>BabelFish</span><span class='colon2 op'>::</span><span class='LANGUAGE_NAMES constant id'>LANGUAGE_NAMES</span><span class='lbrack token'>[</span><span class='c identifier id'>c</span><span class='rbrack token'>]</span>
1933
- <span class='message identifier id'>message</span> <span class='lshft op'>&lt;&lt;</span> <span class='dstring node'>&quot; rake #{t.name} from=#{c} # from #{n}&quot;</span>
1934
- <span class='end end kw'>end</span>
1935
-
1936
- <span class='raise identifier id'>raise</span> <span class='ArgumentError constant id'>ArgumentError</span><span class='comma token'>,</span> <span class='message identifier id'>message</span><span class='dot token'>.</span><span class='join identifier id'>join</span><span class='lparen token'>(</span><span class='string val'>&quot;\n&quot;</span><span class='rparen token'>)</span>
1937
- <span class='end end kw'>end</span>
1938
-
1939
- <span class='begin begin kw'>begin</span>
1940
- <span class='require identifier id'>require</span> <span class='string val'>'yaml'</span>
1941
- <span class='phrases identifier id'>phrases</span> <span class='assign token'>=</span> <span class='YAML constant id'>YAML</span><span class='dot token'>.</span><span class='load_file identifier id'>load_file</span><span class='lparen token'>(</span><span class='lang_dump_file identifier id'>lang_dump_file</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='keys identifier id'>keys</span><span class='dot token'>.</span><span class='sort identifier id'>sort</span>
1942
- <span class='rescue rescue kw'>rescue</span>
1943
- <span class='warn identifier id'>warn</span> <span class='dstring node'>&quot;Could not load phrases from #{lang_dump_file.inspect}&quot;</span>
1944
- <span class='raise identifier id'>raise</span>
1945
- <span class='end end kw'>end</span>
1946
-
1947
- <span class='src_lang_name identifier id'>src_lang_name</span> <span class='assign token'>=</span> <span class='BabelFish constant id'>BabelFish</span><span class='colon2 op'>::</span><span class='LANGUAGE_NAMES constant id'>LANGUAGE_NAMES</span><span class='lbrack token'>[</span><span class='src_lang identifier id'>src_lang</span><span class='rbrack token'>]</span>
1948
-
1949
- <span class='BabelFish constant id'>BabelFish</span><span class='colon2 op'>::</span><span class='LANGUAGE_PAIRS constant id'>LANGUAGE_PAIRS</span><span class='lbrack token'>[</span><span class='src_lang identifier id'>src_lang</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='dst_lang identifier id'>dst_lang</span><span class='bitor op'>|</span>
1950
- <span class='dst_file identifier id'>dst_file</span> <span class='assign token'>=</span> <span class='dstring node'>&quot;lang/#{dst_lang}.yaml&quot;</span>
1951
- <span class='dst_lang_name identifier id'>dst_lang_name</span> <span class='assign token'>=</span> <span class='BabelFish constant id'>BabelFish</span><span class='colon2 op'>::</span><span class='LANGUAGE_NAMES constant id'>LANGUAGE_NAMES</span><span class='lbrack token'>[</span><span class='dst_lang identifier id'>dst_lang</span><span class='rbrack token'>]</span>
1952
-
1953
- <span class='puts identifier id'>puts</span> <span class='dstring node'>&quot;Translating phrases from #{src_lang_name} into #{dst_lang_name} as #{dst_file.inspect}&quot;</span>
1954
-
1955
- <span class='translations identifier id'>translations</span> <span class='assign token'>=</span> <span class='BabelFish constant id'>BabelFish</span><span class='dot token'>.</span><span class='translate identifier id'>translate</span><span class='lparen token'>(</span>
1956
- <span class='phrases identifier id'>phrases</span><span class='dot token'>.</span><span class='join identifier id'>join</span><span class='lparen token'>(</span><span class='lang_conv_delim identifier id'>lang_conv_delim</span><span class='rparen token'>)</span><span class='comma token'>,</span> <span class='src_lang identifier id'>src_lang</span><span class='comma token'>,</span> <span class='dst_lang identifier id'>dst_lang</span>
1957
- <span class='rparen token'>)</span><span class='dot token'>.</span><span class='split identifier id'>split</span><span class='lparen token'>(</span><span class='lang_conv_delim identifier id'>lang_conv_delim</span><span class='rparen token'>)</span>
1958
-
1959
- <span class='File constant id'>File</span><span class='dot token'>.</span><span class='open identifier id'>open</span><span class='lparen token'>(</span><span class='dst_file identifier id'>dst_file</span><span class='comma token'>,</span> <span class='string val'>'w'</span><span class='rparen token'>)</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='f identifier id'>f</span><span class='bitor op'>|</span>
1960
- <span class='f identifier id'>f</span><span class='dot token'>.</span><span class='puts identifier id'>puts</span> <span class='dstring node'>&quot;# #{dst_lang} (#{dst_lang_name})&quot;</span>
1961
-
1962
- <span class='phrases identifier id'>phrases</span><span class='dot token'>.</span><span class='zip identifier id'>zip</span><span class='lparen token'>(</span><span class='translations identifier id'>translations</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='a identifier id'>a</span><span class='comma token'>,</span> <span class='b identifier id'>b</span><span class='bitor op'>|</span>
1963
- <span class='f identifier id'>f</span><span class='dot token'>.</span><span class='puts identifier id'>puts</span> <span class='dstring node'>&quot;#{a}: #{b}&quot;</span>
1964
- <span class='end end kw'>end</span>
1965
- <span class='end end kw'>end</span>
1966
- <span class='end end kw'>end</span>
1967
- <span class='end end kw'>end</span>
1968
-
1969
- <span class='comment val'># testing</span>
1970
- <span class='desc identifier id'>desc</span> <span class='string val'>'Run all unit tests.'</span>
1971
- <span class='task identifier id'>task</span> <span class='symbol val'>:test</span> <span class='do do kw'>do</span>
1972
- <span class='ruby identifier id'>ruby</span> <span class='string val'>'-w'</span><span class='comma token'>,</span> <span class='string val'>'-I.'</span><span class='comma token'>,</span> <span class='string val'>'-Ilib'</span><span class='comma token'>,</span> <span class='string val'>'-r'</span><span class='comma token'>,</span> <span class='program_name identifier id'>program_name</span><span class='comma token'>,</span> <span class='string val'>'-e'</span><span class='comma token'>,</span> <span class='string val'>%q{
1973
- # dump language phrases *after* exercising all code (and
1974
- # thereby populating the phrases cache) in the project
1975
- at_exit do
1976
- if ENV['dump_lang_phrases'] == '1'
1977
- file = %s
1978
- list = %s::PHRASES.phrases
1979
- data = list.map {|s| s + ':' }.join(&quot;\n&quot;)
1980
-
1981
- File.write file, data
1982
-
1983
- puts &quot;Extracted #{list.length} language phrases into #{file.inspect}&quot;
1984
- end
1985
- end
1986
-
1987
- # set title of test suite
1988
- $0 = File.basename(Dir.pwd)
1989
-
1990
- require 'minitest/unit'
1991
- require 'minitest/spec'
1992
- require 'minitest/mock'
1993
- MiniTest::Unit.autorun
1994
-
1995
- Dir['test/**/*.rb'].sort.each do |test|
1996
- unit = test.sub('test/', 'lib/')
1997
-
1998
- if File.exist? unit
1999
- # strip file extension because require()
2000
- # does not normalize its input and it
2001
- # will think that the two paths (with &amp;
2002
- # without file extension) are different
2003
- unit_path = unit.sub(/\.rb$/, '').sub('lib/', '')
2004
- test_path = test.sub(/\.rb$/, '')
2005
-
2006
- require unit_path
2007
- require test_path
2008
- else
2009
- warn &quot;Skipped test #{test.inspect} because it lacks a corresponding #{unit.inspect} unit.&quot;
2010
- end
2011
- end
2012
- }</span> <span class='mod op'>%</span> <span class='lbrack token'>[</span><span class='lang_dump_file identifier id'>lang_dump_file</span><span class='dot token'>.</span><span class='inspect identifier id'>inspect</span><span class='comma token'>,</span> <span class='project_symbol identifier id'>project_symbol</span><span class='rbrack token'>]</span>
2013
- <span class='end end kw'>end</span>
2014
-
2015
- <span class='comment val'># documentation</span>
2016
- <span class='desc identifier id'>desc</span> <span class='string val'>'Build all documentation.'</span>
2017
- <span class='task identifier id'>task</span> <span class='symbol val'>:doc</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='dstring node'>%w[ doc:api doc:man ]</span>
2018
-
2019
- <span class='comment val'># user manual</span>
2020
- <span class='doc_man_src identifier id'>doc_man_src</span> <span class='assign token'>=</span> <span class='string val'>'doc/index.erb'</span>
2021
- <span class='doc_man_dst identifier id'>doc_man_dst</span> <span class='assign token'>=</span> <span class='string val'>'doc/index.xhtml'</span>
2022
- <span class='doc_man_deps identifier id'>doc_man_deps</span> <span class='assign token'>=</span> <span class='FileList constant id'>FileList</span><span class='lbrack token'>[</span><span class='string val'>'doc/*.erb'</span><span class='rbrack token'>]</span>
2023
-
2024
- <span class='doc_man_doc identifier id'>doc_man_doc</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span>
2025
- <span class='task identifier id'>task</span> <span class='symbol val'>:doc_man_doc</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='doc_man_src identifier id'>doc_man_src</span> <span class='do do kw'>do</span>
2026
- <span class='unless unless kw'>unless</span> <span class='doc_man_doc identifier id'>doc_man_doc</span>
2027
- <span class='require identifier id'>require</span> <span class='string val'>'erbook'</span> <span class='unless unless_mod kw'>unless</span> <span class='defined? defined kw'>defined?</span> <span class='ERBook constant id'>ERBook</span>
2028
-
2029
- <span class='doc_man_txt identifier id'>doc_man_txt</span> <span class='assign token'>=</span> <span class='File constant id'>File</span><span class='dot token'>.</span><span class='read identifier id'>read</span><span class='lparen token'>(</span><span class='doc_man_src identifier id'>doc_man_src</span><span class='rparen token'>)</span>
2030
- <span class='doc_man_doc identifier id'>doc_man_doc</span> <span class='assign token'>=</span> <span class='ERBook constant id'>ERBook</span><span class='colon2 op'>::</span><span class='Document constant id'>Document</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='symbol val'>:xhtml</span><span class='comma token'>,</span> <span class='doc_man_txt identifier id'>doc_man_txt</span><span class='comma token'>,</span> <span class='doc_man_src identifier id'>doc_man_src</span><span class='comma token'>,</span> <span class='symbol val'>:unindent</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='true true kw'>true</span><span class='rparen token'>)</span>
2031
- <span class='end end kw'>end</span>
2032
- <span class='end end kw'>end</span>
2033
-
2034
- <span class='desc identifier id'>desc</span> <span class='string val'>'Build the user manual.'</span>
2035
- <span class='task identifier id'>task</span> <span class='string val'>'doc:man'</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='doc_man_dst identifier id'>doc_man_dst</span>
2036
-
2037
- <span class='file identifier id'>file</span> <span class='doc_man_dst identifier id'>doc_man_dst</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='doc_man_deps identifier id'>doc_man_deps</span> <span class='do do kw'>do</span>
2038
- <span class='Rake constant id'>Rake</span><span class='colon2 op'>::</span><span class='Task constant id'>Task</span><span class='lbrack token'>[</span><span class='symbol val'>:doc_man_doc</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='invoke identifier id'>invoke</span>
2039
- <span class='File constant id'>File</span><span class='dot token'>.</span><span class='write identifier id'>write</span> <span class='doc_man_dst identifier id'>doc_man_dst</span><span class='comma token'>,</span> <span class='doc_man_doc identifier id'>doc_man_doc</span>
2040
- <span class='end end kw'>end</span>
2041
-
2042
- <span class='CLOBBER constant id'>CLOBBER</span><span class='dot token'>.</span><span class='include identifier id'>include</span> <span class='doc_man_dst identifier id'>doc_man_dst</span>
2043
-
2044
- <span class='comment val'># API reference</span>
2045
- <span class='doc_api_dst identifier id'>doc_api_dst</span> <span class='assign token'>=</span> <span class='string val'>'doc/api'</span>
2046
-
2047
- <span class='desc identifier id'>desc</span> <span class='string val'>'Build API reference.'</span>
2048
- <span class='task identifier id'>task</span> <span class='string val'>'doc:api'</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='doc_api_dst identifier id'>doc_api_dst</span>
2049
-
2050
- <span class='require identifier id'>require</span> <span class='string val'>'yard'</span>
2051
- <span class='YARD constant id'>YARD</span><span class='colon2 op'>::</span><span class='Rake constant id'>Rake</span><span class='colon2 op'>::</span><span class='YardocTask constant id'>YardocTask</span><span class='dot token'>.</span><span class='new identifier id'>new</span> <span class='doc_api_dst identifier id'>doc_api_dst</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='t identifier id'>t</span><span class='bitor op'>|</span>
2052
- <span class='t identifier id'>t</span><span class='dot token'>.</span><span class='options identifier id'>options</span><span class='dot token'>.</span><span class='push identifier id'>push</span> <span class='string val'>'--protected'</span><span class='comma token'>,</span>
2053
- <span class='string val'>'--output-dir'</span><span class='comma token'>,</span> <span class='doc_api_dst identifier id'>doc_api_dst</span><span class='comma token'>,</span>
2054
- <span class='string val'>'--readme'</span><span class='comma token'>,</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:license_file</span><span class='rbrack token'>]</span>
2055
-
2056
- <span class='task identifier id'>task</span> <span class='doc_api_dst identifier id'>doc_api_dst</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:license_file</span><span class='rbrack token'>]</span>
2057
- <span class='end end kw'>end</span>
2058
-
2059
- <span class='hide_rake_task identifier id'>hide_rake_task</span><span class='lbrack token'>[</span><span class='doc_api_dst identifier id'>doc_api_dst</span><span class='rbrack token'>]</span>
2060
-
2061
- <span class='CLEAN constant id'>CLEAN</span><span class='dot token'>.</span><span class='include identifier id'>include</span> <span class='string val'>'.yardoc'</span>
2062
- <span class='CLOBBER constant id'>CLOBBER</span><span class='dot token'>.</span><span class='include identifier id'>include</span> <span class='doc_api_dst identifier id'>doc_api_dst</span>
2063
-
2064
- <span class='comment val'># announcements</span>
2065
- <span class='desc identifier id'>desc</span> <span class='string val'>'Build all release announcements.'</span>
2066
- <span class='task identifier id'>task</span> <span class='symbol val'>:ann</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='dstring node'>%w[ ann:feed ann:html ann:text ann:mail ]</span>
2067
-
2068
- <span class='comment val'># it has long been a tradition to use an &quot;[ANN]&quot; prefix</span>
2069
- <span class='comment val'># when announcing things on the ruby-talk mailing list</span>
2070
- <span class='ann_prefix identifier id'>ann_prefix</span> <span class='assign token'>=</span> <span class='string val'>'[ANN] '</span>
2071
- <span class='ann_subject identifier id'>ann_subject</span> <span class='assign token'>=</span> <span class='ann_prefix identifier id'>ann_prefix</span> <span class='plus op'>+</span> <span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='DISPLAY constant id'>DISPLAY</span>
2072
- <span class='ann_project identifier id'>ann_project</span> <span class='assign token'>=</span> <span class='ann_prefix identifier id'>ann_prefix</span> <span class='plus op'>+</span> <span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='PROJECT constant id'>PROJECT</span>
2073
-
2074
- <span class='comment val'># fetch the project summary from user manual</span>
2075
- <span class='ann_nfo_doc identifier id'>ann_nfo_doc</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span>
2076
- <span class='task identifier id'>task</span> <span class='symbol val'>:ann_nfo_doc</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='symbol val'>:doc_man_doc</span> <span class='do do kw'>do</span>
2077
- <span class='ann_nfo_doc identifier id'>ann_nfo_doc</span> <span class='assign token'>=</span> <span class='$project_summary_node gvar id'>$project_summary_node</span>
2078
- <span class='end end kw'>end</span>
2079
-
2080
- <span class='comment val'># fetch release notes from user manual</span>
2081
- <span class='ann_rel_doc identifier id'>ann_rel_doc</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span>
2082
- <span class='task identifier id'>task</span> <span class='symbol val'>:ann_rel_doc</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='symbol val'>:doc_man_doc</span> <span class='do do kw'>do</span>
2083
- <span class='unless unless kw'>unless</span> <span class='ann_rel_doc identifier id'>ann_rel_doc</span>
2084
- <span class='if if kw'>if</span> <span class='parent identifier id'>parent</span> <span class='assign token'>=</span> <span class='$project_history_node gvar id'>$project_history_node</span>
2085
- <span class='if if kw'>if</span> <span class='child identifier id'>child</span> <span class='assign token'>=</span> <span class='parent identifier id'>parent</span><span class='dot token'>.</span><span class='children identifier id'>children</span><span class='dot token'>.</span><span class='first identifier id'>first</span>
2086
- <span class='ann_rel_doc identifier id'>ann_rel_doc</span> <span class='assign token'>=</span> <span class='child identifier id'>child</span>
2087
- <span class='else else kw'>else</span>
2088
- <span class='raise identifier id'>raise</span> <span class='string val'>'The &quot;project_history&quot; node in the user manual lacks child nodes.'</span>
2089
- <span class='end end kw'>end</span>
2090
- <span class='else else kw'>else</span>
2091
- <span class='raise identifier id'>raise</span> <span class='string val'>'The user manual lacks a &quot;project_history&quot; node.'</span>
2092
- <span class='end end kw'>end</span>
2093
- <span class='end end kw'>end</span>
2094
- <span class='end end kw'>end</span>
2095
-
2096
- <span class='comment val'># build release notes in HTML and plain text</span>
2097
- <span class='comment val'># converts the given HTML into plain text. we do this using</span>
2098
- <span class='comment val'># lynx because (1) it outputs a list of all hyperlinks used</span>
2099
- <span class='comment val'># in the HTML document and (2) it runs on all major platforms</span>
2100
- <span class='convert_html_to_text identifier id'>convert_html_to_text</span> <span class='assign token'>=</span> <span class='lambda identifier id'>lambda</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='html identifier id'>html</span><span class='bitor op'>|</span>
2101
- <span class='require identifier id'>require</span> <span class='string val'>'tempfile'</span>
2102
-
2103
- <span class='begin begin kw'>begin</span>
2104
- <span class='comment val'># lynx's -dump option requires a .html file</span>
2105
- <span class='tmp_file identifier id'>tmp_file</span> <span class='assign token'>=</span> <span class='Tempfile constant id'>Tempfile</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='Inochi constant id'>Inochi</span><span class='colon2 op'>::</span><span class='PROGRAM constant id'>PROGRAM</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='path identifier id'>path</span> <span class='plus op'>+</span> <span class='string val'>'.html'</span>
2106
-
2107
- <span class='File constant id'>File</span><span class='dot token'>.</span><span class='write identifier id'>write</span> <span class='tmp_file identifier id'>tmp_file</span><span class='comma token'>,</span> <span class='html identifier id'>html</span>
2108
- <span class='text identifier id'>text</span> <span class='assign token'>=</span> <span class='dxstring node'>`lynx -dump #{tmp_file} -width 70`</span>
2109
- <span class='ensure ensure kw'>ensure</span>
2110
- <span class='File constant id'>File</span><span class='dot token'>.</span><span class='delete identifier id'>delete</span> <span class='tmp_file identifier id'>tmp_file</span>
2111
- <span class='end end kw'>end</span>
2112
-
2113
- <span class='comment val'># improve readability of list items</span>
2114
- <span class='comment val'># by adding a blank line between them</span>
2115
- <span class='text identifier id'>text</span><span class='dot token'>.</span><span class='gsub! fid id'>gsub!</span> <span class='regexp val'>%r{(\r?\n)( +\* \S)}</span><span class='comma token'>,</span> <span class='string val'>'\1\1\2'</span>
2116
-
2117
- <span class='text identifier id'>text</span>
2118
- <span class='end end kw'>end</span>
2119
-
2120
- <span class='comment val'># binds relative addresses in the given HTML to the project docsite</span>
2121
- <span class='resolve_html_links identifier id'>resolve_html_links</span> <span class='assign token'>=</span> <span class='lambda identifier id'>lambda</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='html identifier id'>html</span><span class='bitor op'>|</span>
2122
- <span class='comment val'># resolve relative URLs into absolute URLs</span>
2123
- <span class='comment val'># see http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax</span>
2124
- <span class='require identifier id'>require</span> <span class='string val'>'addressable/uri'</span>
2125
- <span class='uri identifier id'>uri</span> <span class='assign token'>=</span> <span class='Addressable constant id'>Addressable</span><span class='colon2 op'>::</span><span class='URI constant id'>URI</span><span class='dot token'>.</span><span class='parse identifier id'>parse</span><span class='lparen token'>(</span><span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='DOCSITE constant id'>DOCSITE</span><span class='rparen token'>)</span>
2126
- <span class='doc_url identifier id'>doc_url</span> <span class='assign token'>=</span> <span class='uri identifier id'>uri</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span>
2127
- <span class='dir_url identifier id'>dir_url</span> <span class='assign token'>=</span> <span class='uri identifier id'>uri</span><span class='dot token'>.</span><span class='path identifier id'>path</span> <span class='match op'>=~</span> <span class='regexp val'>%r{/$|^$}</span> <span class='question op'>?</span> <span class='doc_url identifier id'>doc_url</span> <span class='colon op'>:</span> <span class='File constant id'>File</span><span class='dot token'>.</span><span class='dirname identifier id'>dirname</span><span class='lparen token'>(</span><span class='doc_url identifier id'>doc_url</span><span class='rparen token'>)</span>
2128
-
2129
- <span class='html identifier id'>html</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span><span class='dot token'>.</span><span class='gsub identifier id'>gsub</span> <span class='regexp val'>%r{(href=|src=)(.)(.*?)(\2)}</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='match identifier id'>match</span><span class='bitor op'>|</span>
2130
- <span class='a identifier id'>a</span><span class='comma token'>,</span> <span class='b identifier id'>b</span> <span class='assign token'>=</span> <span class='$1 nth_ref id'>$1</span> <span class='plus op'>+</span> <span class='$2 nth_ref id'>$2</span><span class='comma token'>,</span> <span class='$3 nth_ref id'>$3</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span> <span class='lshft op'>&lt;&lt;</span> <span class='$4 nth_ref id'>$4</span>
2131
-
2132
- <span class='case case kw'>case</span> <span class='$3 nth_ref id'>$3</span>
2133
- <span class='when when kw'>when</span> <span class='regexp val'>%r{^[[:alpha:]][[:alnum:]\+\.\-]*://}</span> <span class='comment val'># already absolute</span>
2134
- <span class='match identifier id'>match</span>
2135
-
2136
- <span class='when when kw'>when</span> <span class='regexp val'>/^#/</span>
2137
- <span class='a identifier id'>a</span> <span class='lshft op'>&lt;&lt;</span> <span class='File constant id'>File</span><span class='dot token'>.</span><span class='join identifier id'>join</span><span class='lparen token'>(</span><span class='doc_url identifier id'>doc_url</span><span class='comma token'>,</span> <span class='b identifier id'>b</span><span class='rparen token'>)</span>
2138
-
2139
- <span class='else else kw'>else</span>
2140
- <span class='a identifier id'>a</span> <span class='lshft op'>&lt;&lt;</span> <span class='File constant id'>File</span><span class='dot token'>.</span><span class='join identifier id'>join</span><span class='lparen token'>(</span><span class='dir_url identifier id'>dir_url</span><span class='comma token'>,</span> <span class='b identifier id'>b</span><span class='rparen token'>)</span>
2141
- <span class='end end kw'>end</span>
2142
- <span class='end end kw'>end</span>
2143
- <span class='end end kw'>end</span>
2144
-
2145
- <span class='ann_html identifier id'>ann_html</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span>
2146
- <span class='task identifier id'>task</span> <span class='symbol val'>:ann_html</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='lbrack token'>[</span><span class='symbol val'>:doc_man_doc</span><span class='comma token'>,</span> <span class='symbol val'>:ann_nfo_doc</span><span class='comma token'>,</span> <span class='symbol val'>:ann_rel_doc</span><span class='rbrack token'>]</span> <span class='do do kw'>do</span>
2147
- <span class='unless unless kw'>unless</span> <span class='ann_html identifier id'>ann_html</span>
2148
- <span class='ann_html identifier id'>ann_html</span> <span class='assign token'>=</span> <span class='dstring node'>%{
2149
- &lt;center&gt;
2150
- &lt;h1&gt;#{project_module::DISPLAY}&lt;/h1&gt;
2151
- &lt;p&gt;#{project_module::TAGLINE}&lt;/p&gt;
2152
- &lt;p&gt;#{project_module::WEBSITE}&lt;/p&gt;
2153
- &lt;/center&gt;
2154
- #{ann_nfo_doc}
2155
- #{ann_rel_doc}
2156
- }</span>
2157
-
2158
- <span class='comment val'># remove heading navigation menus</span>
2159
- <span class='ann_html identifier id'>ann_html</span><span class='dot token'>.</span><span class='gsub! fid id'>gsub!</span> <span class='regexp val'>%r{&lt;div class=&quot;nav&quot;[^&gt;]*&gt;(.*?)&lt;/div&gt;}</span><span class='comma token'>,</span> <span class='string val'>''</span>
2160
-
2161
- <span class='comment val'># remove latex-style heading numbers</span>
2162
- <span class='ann_html identifier id'>ann_html</span><span class='dot token'>.</span><span class='gsub! fid id'>gsub!</span> <span class='regexp val'>%r&quot;(&lt;(h\d)[^&gt;]*&gt;).+?(?:&amp;nbsp;){2}(.+?)(&lt;/\2&gt;)&quot;</span><span class='m identifier id'>m</span><span class='comma token'>,</span> <span class='string val'>'\1\3\4'</span>
2163
-
2164
- <span class='ann_html identifier id'>ann_html</span> <span class='assign token'>=</span> <span class='resolve_html_links identifier id'>resolve_html_links</span><span class='lbrack token'>[</span><span class='ann_html identifier id'>ann_html</span><span class='rbrack token'>]</span>
2165
- <span class='end end kw'>end</span>
2166
- <span class='end end kw'>end</span>
2167
-
2168
- <span class='ann_text identifier id'>ann_text</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span>
2169
- <span class='task identifier id'>task</span> <span class='symbol val'>:ann_text</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='symbol val'>:ann_html</span> <span class='do do kw'>do</span>
2170
- <span class='unless unless kw'>unless</span> <span class='ann_text identifier id'>ann_text</span>
2171
- <span class='ann_text identifier id'>ann_text</span> <span class='assign token'>=</span> <span class='convert_html_to_text identifier id'>convert_html_to_text</span><span class='lbrack token'>[</span><span class='ann_html identifier id'>ann_html</span><span class='rbrack token'>]</span>
2172
- <span class='end end kw'>end</span>
2173
- <span class='end end kw'>end</span>
2174
-
2175
- <span class='ann_nfo_text identifier id'>ann_nfo_text</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span>
2176
- <span class='task identifier id'>task</span> <span class='symbol val'>:ann_nfo_text</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='symbol val'>:ann_nfo_doc</span> <span class='do do kw'>do</span>
2177
- <span class='unless unless kw'>unless</span> <span class='ann_nfo_text identifier id'>ann_nfo_text</span>
2178
- <span class='ann_nfo_html identifier id'>ann_nfo_html</span> <span class='assign token'>=</span> <span class='resolve_html_links identifier id'>resolve_html_links</span><span class='lbrack token'>[</span><span class='ann_nfo_doc identifier id'>ann_nfo_doc</span><span class='rbrack token'>]</span>
2179
- <span class='ann_nfo_text identifier id'>ann_nfo_text</span> <span class='assign token'>=</span> <span class='convert_html_to_text identifier id'>convert_html_to_text</span><span class='lbrack token'>[</span><span class='ann_nfo_html identifier id'>ann_nfo_html</span><span class='rbrack token'>]</span>
2180
- <span class='end end kw'>end</span>
2181
- <span class='end end kw'>end</span>
2182
-
2183
- <span class='comment val'># HTML</span>
2184
- <span class='ann_html_dst identifier id'>ann_html_dst</span> <span class='assign token'>=</span> <span class='string val'>'ANN.html'</span>
2185
-
2186
- <span class='desc identifier id'>desc</span> <span class='dstring node'>&quot;Build HTML announcement: #{ann_html_dst}&quot;</span>
2187
- <span class='task identifier id'>task</span> <span class='string val'>'ann:html'</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='ann_html_dst identifier id'>ann_html_dst</span>
2188
-
2189
- <span class='file identifier id'>file</span> <span class='ann_html_dst identifier id'>ann_html_dst</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='doc_man_deps identifier id'>doc_man_deps</span> <span class='do do kw'>do</span>
2190
- <span class='Rake constant id'>Rake</span><span class='colon2 op'>::</span><span class='Task constant id'>Task</span><span class='lbrack token'>[</span><span class='symbol val'>:ann_html</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='invoke identifier id'>invoke</span>
2191
- <span class='File constant id'>File</span><span class='dot token'>.</span><span class='write identifier id'>write</span> <span class='ann_html_dst identifier id'>ann_html_dst</span><span class='comma token'>,</span> <span class='ann_html identifier id'>ann_html</span>
2192
- <span class='end end kw'>end</span>
2193
-
2194
- <span class='CLEAN constant id'>CLEAN</span><span class='dot token'>.</span><span class='include identifier id'>include</span> <span class='ann_html_dst identifier id'>ann_html_dst</span>
2195
-
2196
- <span class='comment val'># RSS feed</span>
2197
- <span class='ann_feed_dst identifier id'>ann_feed_dst</span> <span class='assign token'>=</span> <span class='string val'>'doc/ann.xml'</span>
2198
-
2199
- <span class='desc identifier id'>desc</span> <span class='dstring node'>&quot;Build RSS announcement: #{ann_feed_dst}&quot;</span>
2200
- <span class='task identifier id'>task</span> <span class='string val'>'ann:feed'</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='ann_feed_dst identifier id'>ann_feed_dst</span>
2201
-
2202
- <span class='file identifier id'>file</span> <span class='ann_feed_dst identifier id'>ann_feed_dst</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='doc_man_deps identifier id'>doc_man_deps</span> <span class='do do kw'>do</span>
2203
- <span class='require identifier id'>require</span> <span class='string val'>'time'</span>
2204
- <span class='require identifier id'>require</span> <span class='string val'>'rss/maker'</span>
2205
-
2206
- <span class='feed identifier id'>feed</span> <span class='assign token'>=</span> <span class='RSS constant id'>RSS</span><span class='colon2 op'>::</span><span class='Maker constant id'>Maker</span><span class='dot token'>.</span><span class='make identifier id'>make</span><span class='lparen token'>(</span><span class='string val'>'2.0'</span><span class='rparen token'>)</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='feed identifier id'>feed</span><span class='bitor op'>|</span>
2207
- <span class='feed identifier id'>feed</span><span class='dot token'>.</span><span class='channel identifier id'>channel</span><span class='dot token'>.</span><span class='title identifier id'>title</span> <span class='assign token'>=</span> <span class='ann_project identifier id'>ann_project</span>
2208
- <span class='feed identifier id'>feed</span><span class='dot token'>.</span><span class='channel identifier id'>channel</span><span class='dot token'>.</span><span class='link identifier id'>link</span> <span class='assign token'>=</span> <span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='WEBSITE constant id'>WEBSITE</span>
2209
- <span class='feed identifier id'>feed</span><span class='dot token'>.</span><span class='channel identifier id'>channel</span><span class='dot token'>.</span><span class='description identifier id'>description</span> <span class='assign token'>=</span> <span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='TAGLINE constant id'>TAGLINE</span>
2210
-
2211
- <span class='Rake constant id'>Rake</span><span class='colon2 op'>::</span><span class='Task constant id'>Task</span><span class='lbrack token'>[</span><span class='symbol val'>:ann_rel_doc</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='invoke identifier id'>invoke</span>
2212
- <span class='Rake constant id'>Rake</span><span class='colon2 op'>::</span><span class='Task constant id'>Task</span><span class='lbrack token'>[</span><span class='symbol val'>:ann_html</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='invoke identifier id'>invoke</span>
2213
-
2214
- <span class='item identifier id'>item</span> <span class='assign token'>=</span> <span class='feed identifier id'>feed</span><span class='dot token'>.</span><span class='items identifier id'>items</span><span class='dot token'>.</span><span class='new_item identifier id'>new_item</span>
2215
- <span class='item identifier id'>item</span><span class='dot token'>.</span><span class='title identifier id'>title</span> <span class='assign token'>=</span> <span class='ann_rel_doc identifier id'>ann_rel_doc</span><span class='dot token'>.</span><span class='title identifier id'>title</span>
2216
- <span class='item identifier id'>item</span><span class='dot token'>.</span><span class='link identifier id'>link</span> <span class='assign token'>=</span> <span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='DOCSITE constant id'>DOCSITE</span> <span class='plus op'>+</span> <span class='string val'>'#'</span> <span class='plus op'>+</span> <span class='ann_rel_doc identifier id'>ann_rel_doc</span><span class='dot token'>.</span><span class='here_frag identifier id'>here_frag</span>
2217
- <span class='item identifier id'>item</span><span class='dot token'>.</span><span class='date identifier id'>date</span> <span class='assign token'>=</span> <span class='Time constant id'>Time</span><span class='dot token'>.</span><span class='parse identifier id'>parse</span><span class='lparen token'>(</span><span class='item identifier id'>item</span><span class='dot token'>.</span><span class='title identifier id'>title</span><span class='rparen token'>)</span>
2218
- <span class='item identifier id'>item</span><span class='dot token'>.</span><span class='description identifier id'>description</span> <span class='assign token'>=</span> <span class='ann_html identifier id'>ann_html</span>
2219
- <span class='end end kw'>end</span>
2220
-
2221
- <span class='File constant id'>File</span><span class='dot token'>.</span><span class='write identifier id'>write</span> <span class='ann_feed_dst identifier id'>ann_feed_dst</span><span class='comma token'>,</span> <span class='feed identifier id'>feed</span>
2222
- <span class='end end kw'>end</span>
2223
-
2224
- <span class='CLOBBER constant id'>CLOBBER</span><span class='dot token'>.</span><span class='include identifier id'>include</span> <span class='ann_feed_dst identifier id'>ann_feed_dst</span>
2225
-
2226
- <span class='comment val'># plain text</span>
2227
- <span class='ann_text_dst identifier id'>ann_text_dst</span> <span class='assign token'>=</span> <span class='string val'>'ANN.txt'</span>
2228
-
2229
- <span class='desc identifier id'>desc</span> <span class='dstring node'>&quot;Build plain text announcement: #{ann_text_dst}&quot;</span>
2230
- <span class='task identifier id'>task</span> <span class='string val'>'ann:text'</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='ann_text_dst identifier id'>ann_text_dst</span>
2231
-
2232
- <span class='file identifier id'>file</span> <span class='ann_text_dst identifier id'>ann_text_dst</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='doc_man_deps identifier id'>doc_man_deps</span> <span class='do do kw'>do</span>
2233
- <span class='Rake constant id'>Rake</span><span class='colon2 op'>::</span><span class='Task constant id'>Task</span><span class='lbrack token'>[</span><span class='symbol val'>:ann_text</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='invoke identifier id'>invoke</span>
2234
- <span class='File constant id'>File</span><span class='dot token'>.</span><span class='write identifier id'>write</span> <span class='ann_text_dst identifier id'>ann_text_dst</span><span class='comma token'>,</span> <span class='ann_text identifier id'>ann_text</span>
2235
- <span class='end end kw'>end</span>
2236
-
2237
- <span class='CLEAN constant id'>CLEAN</span><span class='dot token'>.</span><span class='include identifier id'>include</span> <span class='ann_text_dst identifier id'>ann_text_dst</span>
2238
-
2239
- <span class='comment val'># e-mail</span>
2240
- <span class='ann_mail_dst identifier id'>ann_mail_dst</span> <span class='assign token'>=</span> <span class='string val'>'ANN.eml'</span>
2241
-
2242
- <span class='desc identifier id'>desc</span> <span class='dstring node'>&quot;Build e-mail announcement: #{ann_mail_dst}&quot;</span>
2243
- <span class='task identifier id'>task</span> <span class='string val'>'ann:mail'</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='ann_mail_dst identifier id'>ann_mail_dst</span>
2244
-
2245
- <span class='file identifier id'>file</span> <span class='ann_mail_dst identifier id'>ann_mail_dst</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='doc_man_deps identifier id'>doc_man_deps</span> <span class='do do kw'>do</span>
2246
- <span class='File constant id'>File</span><span class='dot token'>.</span><span class='open identifier id'>open</span> <span class='ann_mail_dst identifier id'>ann_mail_dst</span><span class='comma token'>,</span> <span class='string val'>'w'</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='f identifier id'>f</span><span class='bitor op'>|</span>
2247
- <span class='require identifier id'>require</span> <span class='string val'>'time'</span>
2248
- <span class='f identifier id'>f</span><span class='dot token'>.</span><span class='puts identifier id'>puts</span> <span class='dstring node'>&quot;Date: #{Time.now.rfc822}&quot;</span>
2249
-
2250
- <span class='f identifier id'>f</span><span class='dot token'>.</span><span class='puts identifier id'>puts</span> <span class='string val'>'To: ruby-talk@ruby-lang.org'</span>
2251
- <span class='f identifier id'>f</span><span class='dot token'>.</span><span class='puts identifier id'>puts</span> <span class='string val'>'From: &quot;%s&quot; &lt;%s&gt;'</span> <span class='mod op'>%</span> <span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='AUTHORS constant id'>AUTHORS</span><span class='dot token'>.</span><span class='first identifier id'>first</span>
2252
- <span class='f identifier id'>f</span><span class='dot token'>.</span><span class='puts identifier id'>puts</span> <span class='dstring node'>&quot;Subject: #{ann_subject}&quot;</span>
2253
-
2254
- <span class='Rake constant id'>Rake</span><span class='colon2 op'>::</span><span class='Task constant id'>Task</span><span class='lbrack token'>[</span><span class='symbol val'>:ann_text</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='invoke identifier id'>invoke</span>
2255
- <span class='f identifier id'>f</span><span class='dot token'>.</span><span class='puts identifier id'>puts</span> <span class='string val'>''</span><span class='comma token'>,</span> <span class='ann_text identifier id'>ann_text</span>
2256
- <span class='end end kw'>end</span>
2257
- <span class='end end kw'>end</span>
2258
-
2259
- <span class='CLEAN constant id'>CLEAN</span><span class='dot token'>.</span><span class='include identifier id'>include</span> <span class='ann_mail_dst identifier id'>ann_mail_dst</span>
2260
-
2261
- <span class='comment val'># packaging</span>
2262
- <span class='desc identifier id'>desc</span> <span class='string val'>'Build a release.'</span>
2263
- <span class='task identifier id'>task</span> <span class='symbol val'>:pak</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='lbrack token'>[</span><span class='symbol val'>:clobber</span><span class='comma token'>,</span> <span class='symbol val'>:doc</span><span class='rbrack token'>]</span> <span class='do do kw'>do</span>
2264
- <span class='sh identifier id'>sh</span> <span class='$0 gvar id'>$0</span><span class='comma token'>,</span> <span class='string val'>'package'</span>
2265
- <span class='end end kw'>end</span>
2266
- <span class='CLEAN constant id'>CLEAN</span><span class='dot token'>.</span><span class='include identifier id'>include</span> <span class='string val'>'pkg'</span>
2267
-
2268
- <span class='comment val'># ruby gem</span>
2269
- <span class='require identifier id'>require</span> <span class='string val'>'rake/gempackagetask'</span>
2270
-
2271
- <span class='gem identifier id'>gem</span> <span class='assign token'>=</span> <span class='Gem constant id'>Gem</span><span class='colon2 op'>::</span><span class='Specification constant id'>Specification</span><span class='dot token'>.</span><span class='new identifier id'>new</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='gem identifier id'>gem</span><span class='bitor op'>|</span>
2272
- <span class='authors identifier id'>authors</span> <span class='assign token'>=</span> <span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='AUTHORS constant id'>AUTHORS</span>
2273
-
2274
- <span class='if if kw'>if</span> <span class='author identifier id'>author</span> <span class='assign token'>=</span> <span class='authors identifier id'>authors</span><span class='dot token'>.</span><span class='first identifier id'>first</span>
2275
- <span class='gem identifier id'>gem</span><span class='dot token'>.</span><span class='author identifier id'>author</span><span class='comma token'>,</span> <span class='gem identifier id'>gem</span><span class='dot token'>.</span><span class='email identifier id'>email</span> <span class='assign token'>=</span> <span class='author identifier id'>author</span>
2276
- <span class='end end kw'>end</span>
2277
-
2278
- <span class='if if kw'>if</span> <span class='authors identifier id'>authors</span><span class='dot token'>.</span><span class='length identifier id'>length</span> <span class='gt op'>&gt;</span> <span class='integer val'>1</span>
2279
- <span class='gem identifier id'>gem</span><span class='dot token'>.</span><span class='authors identifier id'>authors</span> <span class='assign token'>=</span> <span class='authors identifier id'>authors</span><span class='dot token'>.</span><span class='map identifier id'>map</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='name identifier id'>name</span><span class='comma token'>,</span> <span class='mail identifier id'>mail</span><span class='bitor op'>|</span> <span class='name identifier id'>name</span> <span class='rbrace token'>}</span>
2280
- <span class='end end kw'>end</span>
2281
-
2282
- <span class='gem identifier id'>gem</span><span class='dot token'>.</span><span class='rubyforge_project identifier id'>rubyforge_project</span> <span class='assign token'>=</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:rubyforge_project</span><span class='rbrack token'>]</span>
2283
-
2284
- <span class='comment val'># XXX: In theory, `gem.name` should be assigned to</span>
2285
- <span class='comment val'># ::PROJECT instead of ::PROGRAM</span>
2286
- <span class='comment val'>#</span>
2287
- <span class='comment val'># In practice, PROJECT may contain non-word</span>
2288
- <span class='comment val'># characters and may also contain a mixture</span>
2289
- <span class='comment val'># of lowercase and uppercase letters.</span>
2290
- <span class='comment val'>#</span>
2291
- <span class='comment val'># This makes it difficult for people to</span>
2292
- <span class='comment val'># install the project gem because they must</span>
2293
- <span class='comment val'># remember the exact spelling used in</span>
2294
- <span class='comment val'># `gem.name` when running `gem install ____`.</span>
2295
- <span class='comment val'>#</span>
2296
- <span class='comment val'># For example, consider the &quot;RedCloth&quot; gem.</span>
2297
- <span class='comment val'>#</span>
2298
- <span class='gem identifier id'>gem</span><span class='dot token'>.</span><span class='name identifier id'>name</span> <span class='assign token'>=</span> <span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='PROGRAM constant id'>PROGRAM</span>
2299
-
2300
- <span class='gem identifier id'>gem</span><span class='dot token'>.</span><span class='version identifier id'>version</span> <span class='assign token'>=</span> <span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='VERSION constant id'>VERSION</span>
2301
- <span class='gem identifier id'>gem</span><span class='dot token'>.</span><span class='summary identifier id'>summary</span> <span class='assign token'>=</span> <span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='TAGLINE constant id'>TAGLINE</span>
2302
- <span class='gem identifier id'>gem</span><span class='dot token'>.</span><span class='description identifier id'>description</span> <span class='assign token'>=</span> <span class='gem identifier id'>gem</span><span class='dot token'>.</span><span class='summary identifier id'>summary</span>
2303
- <span class='gem identifier id'>gem</span><span class='dot token'>.</span><span class='homepage identifier id'>homepage</span> <span class='assign token'>=</span> <span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='WEBSITE constant id'>WEBSITE</span>
2304
- <span class='gem identifier id'>gem</span><span class='dot token'>.</span><span class='files identifier id'>files</span> <span class='assign token'>=</span> <span class='FileList constant id'>FileList</span><span class='lbrack token'>[</span><span class='string val'>'**/*'</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='exclude identifier id'>exclude</span><span class='lparen token'>(</span><span class='string val'>'_darcs'</span><span class='rparen token'>)</span> <span class='minus op'>-</span> <span class='CLEAN constant id'>CLEAN</span>
2305
- <span class='gem identifier id'>gem</span><span class='dot token'>.</span><span class='executables identifier id'>executables</span> <span class='assign token'>=</span> <span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='PROGRAM constant id'>PROGRAM</span>
2306
- <span class='gem identifier id'>gem</span><span class='dot token'>.</span><span class='has_rdoc identifier id'>has_rdoc</span> <span class='assign token'>=</span> <span class='true true kw'>true</span>
2307
-
2308
- <span class='unless unless kw'>unless</span> <span class='project_module identifier id'>project_module</span> <span class='eq op'>==</span> <span class='Inochi constant id'>Inochi</span>
2309
- <span class='gem identifier id'>gem</span><span class='dot token'>.</span><span class='add_dependency identifier id'>add_dependency</span> <span class='string val'>'inochi'</span><span class='comma token'>,</span> <span class='Inochi constant id'>Inochi</span><span class='colon2 op'>::</span><span class='VERSION constant id'>VERSION</span><span class='dot token'>.</span><span class='requirement identifier id'>requirement</span>
2310
- <span class='end end kw'>end</span>
2311
-
2312
- <span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='REQUIRE constant id'>REQUIRE</span><span class='dot token'>.</span><span class='each_pair identifier id'>each_pair</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='gem_name identifier id'>gem_name</span><span class='comma token'>,</span> <span class='version_reqs identifier id'>version_reqs</span><span class='bitor op'>|</span>
2313
- <span class='gem identifier id'>gem</span><span class='dot token'>.</span><span class='add_dependency identifier id'>add_dependency</span> <span class='gem_name identifier id'>gem_name</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='version_reqs identifier id'>version_reqs</span>
2314
- <span class='end end kw'>end</span>
2315
-
2316
- <span class='comment val'># additional configuration is done by user</span>
2317
- <span class='yield yield kw'>yield</span> <span class='gem identifier id'>gem</span> <span class='if if_mod kw'>if</span> <span class='gem_config identifier id'>gem_config</span>
2318
- <span class='end end kw'>end</span>
2319
-
2320
- <span class='Rake constant id'>Rake</span><span class='colon2 op'>::</span><span class='GemPackageTask constant id'>GemPackageTask</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='gem identifier id'>gem</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='define identifier id'>define</span>
2321
-
2322
- <span class='comment val'># XXX: hide the tasks defined by the above gem packaging library</span>
2323
- <span class='dstring node'>%w[gem package repackage clobber_package]</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='t identifier id'>t</span><span class='bitor op'>|</span> <span class='hide_rake_task identifier id'>hide_rake_task</span><span class='lbrack token'>[</span><span class='t identifier id'>t</span><span class='rbrack token'>]</span> <span class='rbrace token'>}</span>
2324
-
2325
- <span class='comment val'># releasing</span>
2326
- <span class='desc identifier id'>desc</span> <span class='string val'>'Publish a release.'</span>
2327
- <span class='task identifier id'>task</span> <span class='string val'>'pub'</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='dstring node'>%w[ pub:pak pub:doc pub:ann ]</span>
2328
-
2329
- <span class='comment val'># connect to RubyForge services</span>
2330
- <span class='pub_forge identifier id'>pub_forge</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span>
2331
- <span class='pub_forge_project identifier id'>pub_forge_project</span> <span class='assign token'>=</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:rubyforge_project</span><span class='rbrack token'>]</span>
2332
- <span class='pub_forge_section identifier id'>pub_forge_section</span> <span class='assign token'>=</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:rubyforge_section</span><span class='rbrack token'>]</span>
2333
-
2334
- <span class='task identifier id'>task</span> <span class='symbol val'>:pub_forge</span> <span class='do do kw'>do</span>
2335
- <span class='require identifier id'>require</span> <span class='string val'>'rubyforge'</span>
2336
- <span class='pub_forge identifier id'>pub_forge</span> <span class='assign token'>=</span> <span class='RubyForge constant id'>RubyForge</span><span class='dot token'>.</span><span class='new identifier id'>new</span>
2337
- <span class='pub_forge identifier id'>pub_forge</span><span class='dot token'>.</span><span class='configure identifier id'>configure</span><span class='lparen token'>(</span><span class='string val'>'release_date'</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='RELEASE constant id'>RELEASE</span><span class='rparen token'>)</span>
2338
-
2339
- <span class='unless unless kw'>unless</span> <span class='pub_forge identifier id'>pub_forge</span><span class='dot token'>.</span><span class='autoconfig identifier id'>autoconfig</span><span class='lbrack token'>[</span><span class='string val'>'group_ids'</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='key? fid id'>key?</span> <span class='pub_forge_project identifier id'>pub_forge_project</span>
2340
- <span class='raise identifier id'>raise</span> <span class='dstring node'>&quot;The #{pub_forge_project.inspect} project was not recognized by the RubyForge client. Either specify a different RubyForge project by passing the :rubyforge_project option to Inochi.rake(), or ensure that the client is configured correctly (see `rubyforge --help` for help) and try again.&quot;</span>
2341
- <span class='end end kw'>end</span>
2342
-
2343
- <span class='pub_forge identifier id'>pub_forge</span><span class='dot token'>.</span><span class='login identifier id'>login</span>
2344
- <span class='end end kw'>end</span>
2345
-
2346
- <span class='comment val'># documentation</span>
2347
- <span class='desc identifier id'>desc</span> <span class='string val'>'Publish documentation to project website.'</span>
2348
- <span class='task identifier id'>task</span> <span class='string val'>'pub:doc'</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='lbrack token'>[</span><span class='symbol val'>:doc</span><span class='comma token'>,</span> <span class='string val'>'ann:feed'</span><span class='rbrack token'>]</span> <span class='do do kw'>do</span>
2349
- <span class='target identifier id'>target</span> <span class='assign token'>=</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:upload_target</span><span class='rbrack token'>]</span>
2350
-
2351
- <span class='unless unless kw'>unless</span> <span class='target identifier id'>target</span>
2352
- <span class='require identifier id'>require</span> <span class='string val'>'addressable/uri'</span>
2353
- <span class='docsite identifier id'>docsite</span> <span class='assign token'>=</span> <span class='Addressable constant id'>Addressable</span><span class='colon2 op'>::</span><span class='URI constant id'>URI</span><span class='dot token'>.</span><span class='parse identifier id'>parse</span><span class='lparen token'>(</span><span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='DOCSITE constant id'>DOCSITE</span><span class='rparen token'>)</span>
2354
-
2355
- <span class='comment val'># provide uploading capability to websites hosted on RubyForge</span>
2356
- <span class='if if kw'>if</span> <span class='docsite identifier id'>docsite</span><span class='dot token'>.</span><span class='host identifier id'>host</span><span class='dot token'>.</span><span class='include? fid id'>include?</span> <span class='string val'>'.rubyforge.org'</span>
2357
- <span class='target identifier id'>target</span> <span class='assign token'>=</span> <span class='dstring node'>&quot;#{pub_forge.userconfig['username']}@rubyforge.org:#{File.join '/var/www/gforge-projects', options[:rubyforge_project], docsite.path}&quot;</span>
2358
- <span class='end end kw'>end</span>
2359
- <span class='end end kw'>end</span>
2360
-
2361
- <span class='if if kw'>if</span> <span class='target identifier id'>target</span>
2362
- <span class='cmd identifier id'>cmd</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='string val'>'rsync'</span><span class='comma token'>,</span> <span class='string val'>'-auvz'</span><span class='comma token'>,</span> <span class='string val'>'doc/'</span><span class='comma token'>,</span> <span class='dstring node'>&quot;#{target}/&quot;</span><span class='rbrack token'>]</span>
2363
- <span class='cmd identifier id'>cmd</span><span class='dot token'>.</span><span class='push identifier id'>push</span> <span class='string val'>'--delete'</span> <span class='if if_mod kw'>if</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:upload_delete</span><span class='rbrack token'>]</span>
2364
- <span class='cmd identifier id'>cmd</span><span class='dot token'>.</span><span class='concat identifier id'>concat</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:upload_options</span><span class='rbrack token'>]</span>
2365
-
2366
- <span class='p identifier id'>p</span> <span class='cmd identifier id'>cmd</span>
2367
- <span class='sh identifier id'>sh</span><span class='lparen token'>(</span><span class='mult op'>*</span><span class='cmd identifier id'>cmd</span><span class='rparen token'>)</span>
2368
- <span class='end end kw'>end</span>
2369
- <span class='end end kw'>end</span>
2370
-
2371
- <span class='comment val'># announcement</span>
2372
- <span class='desc identifier id'>desc</span> <span class='string val'>'Publish all announcements.'</span>
2373
- <span class='task identifier id'>task</span> <span class='string val'>'pub:ann'</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='dstring node'>%w[ pub:ann:forge pub:ann:raa pub:ann:talk ]</span>
2374
-
2375
- <span class='comment val'># login information</span>
2376
- <span class='ann_logins_file identifier id'>ann_logins_file</span> <span class='assign token'>=</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:logins_file</span><span class='rbrack token'>]</span>
2377
- <span class='ann_logins identifier id'>ann_logins</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span>
2378
-
2379
- <span class='task identifier id'>task</span> <span class='symbol val'>:ann_logins</span> <span class='do do kw'>do</span>
2380
- <span class='ann_logins identifier id'>ann_logins</span> <span class='assign token'>=</span> <span class='begin begin kw'>begin</span>
2381
- <span class='require identifier id'>require</span> <span class='string val'>'yaml'</span>
2382
- <span class='YAML constant id'>YAML</span><span class='dot token'>.</span><span class='load_file identifier id'>load_file</span> <span class='ann_logins_file identifier id'>ann_logins_file</span>
2383
- <span class='rescue rescue kw'>rescue</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='e identifier id'>e</span>
2384
- <span class='warn identifier id'>warn</span> <span class='dstring node'>&quot;Could not read login information from #{ann_logins_file.inspect}:&quot;</span>
2385
- <span class='warn identifier id'>warn</span> <span class='e identifier id'>e</span>
2386
- <span class='warn identifier id'>warn</span> <span class='string val'>&quot;** You will NOT be able to publish release announcements! **&quot;</span>
2387
- <span class='lbrace token'>{</span><span class='rbrace token'>}</span>
2388
- <span class='end end kw'>end</span>
2389
- <span class='end end kw'>end</span>
2390
-
2391
- <span class='desc identifier id'>desc</span> <span class='string val'>'Announce to RubyForge news.'</span>
2392
- <span class='task identifier id'>task</span> <span class='string val'>'pub:ann:forge'</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='symbol val'>:pub_forge</span> <span class='do do kw'>do</span>
2393
- <span class='puts identifier id'>puts</span> <span class='string val'>'Announcing to RubyForge news...'</span>
2394
-
2395
- <span class='project identifier id'>project</span> <span class='assign token'>=</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:rubyforge_project</span><span class='rbrack token'>]</span>
2396
-
2397
- <span class='if if kw'>if</span> <span class='group_id identifier id'>group_id</span> <span class='assign token'>=</span> <span class='pub_forge identifier id'>pub_forge</span><span class='dot token'>.</span><span class='autoconfig identifier id'>autoconfig</span><span class='lbrack token'>[</span><span class='string val'>'group_ids'</span><span class='rbrack token'>]</span><span class='lbrack token'>[</span><span class='project identifier id'>project</span><span class='rbrack token'>]</span>
2398
- <span class='comment val'># check if this release was already announced</span>
2399
- <span class='require identifier id'>require</span> <span class='string val'>'mechanize'</span>
2400
- <span class='www identifier id'>www</span> <span class='assign token'>=</span> <span class='WWW constant id'>WWW</span><span class='colon2 op'>::</span><span class='Mechanize constant id'>Mechanize</span><span class='dot token'>.</span><span class='new identifier id'>new</span>
2401
- <span class='page identifier id'>page</span> <span class='assign token'>=</span> <span class='www identifier id'>www</span><span class='dot token'>.</span><span class='get identifier id'>get</span> <span class='dstring node'>&quot;http://rubyforge.org/news/?group_id=#{group_id}&quot;</span>
2402
-
2403
- <span class='posts identifier id'>posts</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='page identifier id'>page</span><span class='div op'>/</span><span class='string val'>'//a[starts-with(./@href, &quot;/forum/forum.php?forum_id=&quot;)]/text()'</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='map identifier id'>map</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='e identifier id'>e</span><span class='bitor op'>|</span> <span class='e identifier id'>e</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span><span class='dot token'>.</span><span class='gsub identifier id'>gsub</span><span class='lparen token'>(</span><span class='string val'>&quot;\302\240&quot;</span><span class='comma token'>,</span> <span class='string val'>''</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='strip identifier id'>strip</span> <span class='rbrace token'>}</span>
2404
-
2405
- <span class='already_announced identifier id'>already_announced</span> <span class='assign token'>=</span> <span class='posts identifier id'>posts</span><span class='dot token'>.</span><span class='include? fid id'>include?</span> <span class='ann_subject identifier id'>ann_subject</span>
2406
-
2407
- <span class='if if kw'>if</span> <span class='already_announced identifier id'>already_announced</span>
2408
- <span class='warn identifier id'>warn</span> <span class='string val'>'This release was already announced to RubyForge news, so I will NOT announce it there again.'</span>
2409
- <span class='else else kw'>else</span>
2410
- <span class='comment val'># make the announcement</span>
2411
- <span class='Rake constant id'>Rake</span><span class='colon2 op'>::</span><span class='Task constant id'>Task</span><span class='lbrack token'>[</span><span class='symbol val'>:ann_text</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='invoke identifier id'>invoke</span>
2412
- <span class='pub_forge identifier id'>pub_forge</span><span class='dot token'>.</span><span class='post_news identifier id'>post_news</span> <span class='project identifier id'>project</span><span class='comma token'>,</span> <span class='ann_subject identifier id'>ann_subject</span><span class='comma token'>,</span> <span class='ann_text identifier id'>ann_text</span>
2413
-
2414
- <span class='puts identifier id'>puts</span> <span class='string val'>'Successfully announced to RubyForge news:'</span><span class='comma token'>,</span> <span class='page identifier id'>page</span><span class='dot token'>.</span><span class='uri identifier id'>uri</span>
2415
- <span class='end end kw'>end</span>
2416
- <span class='else else kw'>else</span>
2417
- <span class='raise identifier id'>raise</span> <span class='dstring node'>&quot;Could not determine the group_id of the #{project.inspect} RubyForge project. Run `rubyforge config` and try again.&quot;</span>
2418
- <span class='end end kw'>end</span>
2419
- <span class='end end kw'>end</span>
2420
-
2421
- <span class='desc identifier id'>desc</span> <span class='string val'>'Announce to ruby-talk mailing list.'</span>
2422
- <span class='task identifier id'>task</span> <span class='string val'>'pub:ann:talk'</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='symbol val'>:ann_logins</span> <span class='do do kw'>do</span>
2423
- <span class='puts identifier id'>puts</span> <span class='string val'>'Announcing to ruby-talk mailing list...'</span>
2424
-
2425
- <span class='host identifier id'>host</span> <span class='assign token'>=</span> <span class='string val'>'http://ruby-forum.com'</span>
2426
- <span class='ruby_talk identifier id'>ruby_talk</span> <span class='assign token'>=</span> <span class='integer val'>4</span> <span class='comment val'># ruby-talk forum ID</span>
2427
-
2428
- <span class='require identifier id'>require</span> <span class='string val'>'mechanize'</span>
2429
- <span class='www identifier id'>www</span> <span class='assign token'>=</span> <span class='WWW constant id'>WWW</span><span class='colon2 op'>::</span><span class='Mechanize constant id'>Mechanize</span><span class='dot token'>.</span><span class='new identifier id'>new</span>
2430
-
2431
- <span class='comment val'># check if this release was already announced</span>
2432
- <span class='already_announced identifier id'>already_announced</span> <span class='assign token'>=</span>
2433
- <span class='begin begin kw'>begin</span>
2434
- <span class='page identifier id'>page</span> <span class='assign token'>=</span> <span class='www identifier id'>www</span><span class='dot token'>.</span><span class='get identifier id'>get</span> <span class='dstring node'>&quot;#{host}/forum/#{ruby_talk}&quot;</span><span class='comma token'>,</span> <span class='symbol val'>:filter</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='dstring node'>%{&quot;#{ann_subject}&quot;}</span>
2435
-
2436
- <span class='posts identifier id'>posts</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='page identifier id'>page</span><span class='div op'>/</span><span class='string val'>'//div[@class=&quot;forum&quot;]//a[starts-with(./@href, &quot;/topic/&quot;)]/text()'</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='map identifier id'>map</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='e identifier id'>e</span><span class='bitor op'>|</span> <span class='e identifier id'>e</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span><span class='dot token'>.</span><span class='strip identifier id'>strip</span> <span class='rbrace token'>}</span>
2437
- <span class='posts identifier id'>posts</span><span class='dot token'>.</span><span class='include? fid id'>include?</span> <span class='ann_subject identifier id'>ann_subject</span>
2438
- <span class='rescue rescue kw'>rescue</span>
2439
- <span class='false false kw'>false</span>
2440
- <span class='end end kw'>end</span>
2441
-
2442
- <span class='if if kw'>if</span> <span class='already_announced identifier id'>already_announced</span>
2443
- <span class='warn identifier id'>warn</span> <span class='string val'>'This release was already announced to the ruby-talk mailing list, so I will NOT announce it there again.'</span>
2444
- <span class='else else kw'>else</span>
2445
- <span class='comment val'># log in to RubyForum</span>
2446
- <span class='page identifier id'>page</span> <span class='assign token'>=</span> <span class='www identifier id'>www</span><span class='dot token'>.</span><span class='get identifier id'>get</span> <span class='dstring node'>&quot;#{host}/user/login&quot;</span>
2447
- <span class='form identifier id'>form</span> <span class='assign token'>=</span> <span class='page identifier id'>page</span><span class='dot token'>.</span><span class='forms identifier id'>forms</span><span class='dot token'>.</span><span class='first identifier id'>first</span>
2448
-
2449
- <span class='if if kw'>if</span> <span class='login identifier id'>login</span> <span class='assign token'>=</span> <span class='ann_logins identifier id'>ann_logins</span><span class='lbrack token'>[</span><span class='string val'>'www.ruby-forum.com'</span><span class='rbrack token'>]</span>
2450
- <span class='form identifier id'>form</span><span class='lbrack token'>[</span><span class='string val'>'name'</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='login identifier id'>login</span><span class='lbrack token'>[</span><span class='string val'>'user'</span><span class='rbrack token'>]</span>
2451
- <span class='form identifier id'>form</span><span class='lbrack token'>[</span><span class='string val'>'password'</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='login identifier id'>login</span><span class='lbrack token'>[</span><span class='string val'>'pass'</span><span class='rbrack token'>]</span>
2452
- <span class='end end kw'>end</span>
2453
-
2454
- <span class='page identifier id'>page</span> <span class='assign token'>=</span> <span class='form identifier id'>form</span><span class='dot token'>.</span><span class='click_button identifier id'>click_button</span> <span class='comment val'># use the first submit button</span>
2455
-
2456
- <span class='if if kw'>if</span> <span class='lparen token'>(</span><span class='page identifier id'>page</span><span class='div op'>/</span><span class='string val'>'//a[@href=&quot;/user/logout&quot;]'</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='empty? fid id'>empty?</span>
2457
- <span class='warn identifier id'>warn</span> <span class='dstring node'>&quot;Could not log in to RubyForum using the login information in #{ann_logins_file.inspect}, so I can NOT announce this release to the ruby-talk mailing list.&quot;</span>
2458
- <span class='else else kw'>else</span>
2459
- <span class='comment val'># make the announcement</span>
2460
- <span class='page identifier id'>page</span> <span class='assign token'>=</span> <span class='www identifier id'>www</span><span class='dot token'>.</span><span class='get identifier id'>get</span> <span class='dstring node'>&quot;#{host}/topic/new?forum_id=#{ruby_talk}&quot;</span>
2461
- <span class='form identifier id'>form</span> <span class='assign token'>=</span> <span class='page identifier id'>page</span><span class='dot token'>.</span><span class='forms identifier id'>forms</span><span class='dot token'>.</span><span class='first identifier id'>first</span>
2462
-
2463
- <span class='Rake constant id'>Rake</span><span class='colon2 op'>::</span><span class='Task constant id'>Task</span><span class='lbrack token'>[</span><span class='symbol val'>:ann_text</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='invoke identifier id'>invoke</span>
2464
- <span class='form identifier id'>form</span><span class='lbrack token'>[</span><span class='string val'>'post[subject]'</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='ann_subject identifier id'>ann_subject</span>
2465
- <span class='form identifier id'>form</span><span class='lbrack token'>[</span><span class='string val'>'post[text]'</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='ann_text identifier id'>ann_text</span>
2466
-
2467
- <span class='form identifier id'>form</span><span class='dot token'>.</span><span class='checkboxes identifier id'>checkboxes</span><span class='dot token'>.</span><span class='first identifier id'>first</span><span class='dot token'>.</span><span class='check identifier id'>check</span> <span class='comment val'># enable email notification</span>
2468
- <span class='page identifier id'>page</span> <span class='assign token'>=</span> <span class='form identifier id'>form</span><span class='dot token'>.</span><span class='submit identifier id'>submit</span>
2469
-
2470
- <span class='errors identifier id'>errors</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='page identifier id'>page</span><span class='div op'>/</span><span class='string val'>'//div[@class=&quot;error&quot;]/text()'</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='flatten identifier id'>flatten</span>
2471
- <span class='if if kw'>if</span> <span class='errors identifier id'>errors</span><span class='dot token'>.</span><span class='empty? fid id'>empty?</span>
2472
- <span class='puts identifier id'>puts</span> <span class='string val'>'Successfully announced to ruby-talk mailing list:'</span><span class='comma token'>,</span> <span class='page identifier id'>page</span><span class='dot token'>.</span><span class='uri identifier id'>uri</span>
2473
- <span class='else else kw'>else</span>
2474
- <span class='warn identifier id'>warn</span> <span class='string val'>'Could not announce to ruby-talk mailing list:'</span>
2475
- <span class='warn identifier id'>warn</span> <span class='errors identifier id'>errors</span><span class='dot token'>.</span><span class='join identifier id'>join</span><span class='lparen token'>(</span><span class='string val'>&quot;\n&quot;</span><span class='rparen token'>)</span>
2476
- <span class='end end kw'>end</span>
2477
- <span class='end end kw'>end</span>
2478
- <span class='end end kw'>end</span>
2479
- <span class='end end kw'>end</span>
2480
-
2481
- <span class='desc identifier id'>desc</span> <span class='string val'>'Announce to RAA (Ruby Application Archive).'</span>
2482
- <span class='task identifier id'>task</span> <span class='string val'>'pub:ann:raa'</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='symbol val'>:ann_logins</span> <span class='do do kw'>do</span>
2483
- <span class='puts identifier id'>puts</span> <span class='string val'>'Announcing to RAA (Ruby Application Archive)...'</span>
2484
-
2485
- <span class='show_page_error identifier id'>show_page_error</span> <span class='assign token'>=</span> <span class='lambda identifier id'>lambda</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='page identifier id'>page</span><span class='comma token'>,</span> <span class='message identifier id'>message</span><span class='bitor op'>|</span>
2486
- <span class='warn identifier id'>warn</span> <span class='dstring node'>&quot;#{message}, so I can NOT announce this release to RAA:&quot;</span>
2487
- <span class='warn identifier id'>warn</span> <span class='dstring node'>&quot;#{(page/'h2').text} -- #{(page/'p').first.text.strip}&quot;</span>
2488
- <span class='end end kw'>end</span>
2489
-
2490
- <span class='resource identifier id'>resource</span> <span class='assign token'>=</span> <span class='dstring node'>&quot;#{options[:raa_project].inspect} project entry on RAA&quot;</span>
2491
-
2492
- <span class='require identifier id'>require</span> <span class='string val'>'mechanize'</span>
2493
- <span class='www identifier id'>www</span> <span class='assign token'>=</span> <span class='WWW constant id'>WWW</span><span class='colon2 op'>::</span><span class='Mechanize constant id'>Mechanize</span><span class='dot token'>.</span><span class='new identifier id'>new</span>
2494
- <span class='page identifier id'>page</span> <span class='assign token'>=</span> <span class='www identifier id'>www</span><span class='dot token'>.</span><span class='get identifier id'>get</span> <span class='dstring node'>&quot;http://raa.ruby-lang.org/update.rhtml?name=#{options[:raa_project]}&quot;</span>
2495
-
2496
- <span class='if if kw'>if</span> <span class='form identifier id'>form</span> <span class='assign token'>=</span> <span class='page identifier id'>page</span><span class='dot token'>.</span><span class='forms identifier id'>forms</span><span class='lbrack token'>[</span><span class='integer val'>1</span><span class='rbrack token'>]</span>
2497
- <span class='resource identifier id'>resource</span> <span class='lshft op'>&lt;&lt;</span> <span class='dstring node'>&quot; (owned by #{form.owner.inspect})&quot;</span>
2498
-
2499
- <span class='Rake constant id'>Rake</span><span class='colon2 op'>::</span><span class='Task constant id'>Task</span><span class='lbrack token'>[</span><span class='symbol val'>:ann_nfo_text</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='invoke identifier id'>invoke</span>
2500
- <span class='form identifier id'>form</span><span class='lbrack token'>[</span><span class='string val'>'description'</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='ann_nfo_text identifier id'>ann_nfo_text</span>
2501
- <span class='form identifier id'>form</span><span class='lbrack token'>[</span><span class='string val'>'description_style'</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='string val'>'Pre-formatted'</span>
2502
- <span class='form identifier id'>form</span><span class='lbrack token'>[</span><span class='string val'>'short_description'</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='TAGLINE constant id'>TAGLINE</span>
2503
- <span class='form identifier id'>form</span><span class='lbrack token'>[</span><span class='string val'>'version'</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='VERSION constant id'>VERSION</span>
2504
- <span class='form identifier id'>form</span><span class='lbrack token'>[</span><span class='string val'>'url'</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='WEBSITE constant id'>WEBSITE</span>
2505
- <span class='form identifier id'>form</span><span class='lbrack token'>[</span><span class='string val'>'pass'</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='ann_logins identifier id'>ann_logins</span><span class='lbrack token'>[</span><span class='string val'>'raa.ruby-lang.org'</span><span class='rbrack token'>]</span><span class='lbrack token'>[</span><span class='string val'>'pass'</span><span class='rbrack token'>]</span>
2506
-
2507
- <span class='page identifier id'>page</span> <span class='assign token'>=</span> <span class='form identifier id'>form</span><span class='dot token'>.</span><span class='submit identifier id'>submit</span>
2508
-
2509
- <span class='if if kw'>if</span> <span class='page identifier id'>page</span><span class='dot token'>.</span><span class='title identifier id'>title</span> <span class='match op'>=~</span> <span class='regexp val'>/error/i</span>
2510
- <span class='show_page_error identifier id'>show_page_error</span><span class='lbrack token'>[</span><span class='page identifier id'>page</span><span class='comma token'>,</span> <span class='dstring node'>&quot;Could not update #{resource}&quot;</span><span class='rbrack token'>]</span>
2511
- <span class='else else kw'>else</span>
2512
- <span class='puts identifier id'>puts</span> <span class='string val'>'Successfully announced to RAA (Ruby Application Archive).'</span>
2513
- <span class='end end kw'>end</span>
2514
- <span class='else else kw'>else</span>
2515
- <span class='show_page_error identifier id'>show_page_error</span><span class='lbrack token'>[</span><span class='page identifier id'>page</span><span class='comma token'>,</span> <span class='dstring node'>&quot;Could not access #{resource}&quot;</span><span class='rbrack token'>]</span>
2516
- <span class='end end kw'>end</span>
2517
- <span class='end end kw'>end</span>
2518
-
2519
- <span class='comment val'># release packages</span>
2520
- <span class='desc identifier id'>desc</span> <span class='string val'>'Publish release packages to RubyForge.'</span>
2521
- <span class='task identifier id'>task</span> <span class='string val'>'pub:pak'</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='symbol val'>:pub_forge</span> <span class='do do kw'>do</span>
2522
- <span class='comment val'># check if this release was already published</span>
2523
- <span class='version identifier id'>version</span> <span class='assign token'>=</span> <span class='project_module identifier id'>project_module</span><span class='colon2 op'>::</span><span class='VERSION constant id'>VERSION</span>
2524
- <span class='packages identifier id'>packages</span> <span class='assign token'>=</span> <span class='pub_forge identifier id'>pub_forge</span><span class='dot token'>.</span><span class='autoconfig identifier id'>autoconfig</span><span class='lbrack token'>[</span><span class='string val'>'release_ids'</span><span class='rbrack token'>]</span><span class='lbrack token'>[</span><span class='pub_forge_section identifier id'>pub_forge_section</span><span class='rbrack token'>]</span>
2525
-
2526
- <span class='if if kw'>if</span> <span class='packages identifier id'>packages</span> <span class='and and kw'>and</span> <span class='packages identifier id'>packages</span><span class='dot token'>.</span><span class='key? fid id'>key?</span> <span class='version identifier id'>version</span>
2527
- <span class='warn identifier id'>warn</span> <span class='string val'>&quot;The release packages were already published, so I will NOT publish them again.&quot;</span>
2528
- <span class='else else kw'>else</span>
2529
- <span class='comment val'># create the FRS package section</span>
2530
- <span class='unless unless kw'>unless</span> <span class='pub_forge identifier id'>pub_forge</span><span class='dot token'>.</span><span class='autoconfig identifier id'>autoconfig</span><span class='lbrack token'>[</span><span class='string val'>'package_ids'</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='key? fid id'>key?</span> <span class='pub_forge_section identifier id'>pub_forge_section</span>
2531
- <span class='pub_forge identifier id'>pub_forge</span><span class='dot token'>.</span><span class='create_package identifier id'>create_package</span> <span class='pub_forge_project identifier id'>pub_forge_project</span><span class='comma token'>,</span> <span class='pub_forge_section identifier id'>pub_forge_section</span>
2532
- <span class='end end kw'>end</span>
2533
-
2534
- <span class='comment val'># publish the package to the section</span>
2535
- <span class='uploader identifier id'>uploader</span> <span class='assign token'>=</span> <span class='lambda identifier id'>lambda</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='command identifier id'>command</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='files identifier id'>files</span><span class='bitor op'>|</span>
2536
- <span class='pub_forge identifier id'>pub_forge</span><span class='dot token'>.</span><span class='__send__ identifier id'>__send__</span> <span class='command identifier id'>command</span><span class='comma token'>,</span> <span class='pub_forge_project identifier id'>pub_forge_project</span><span class='comma token'>,</span> <span class='pub_forge_section identifier id'>pub_forge_section</span><span class='comma token'>,</span> <span class='version identifier id'>version</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='files identifier id'>files</span>
2537
- <span class='end end kw'>end</span>
2538
-
2539
- <span class='Rake constant id'>Rake</span><span class='colon2 op'>::</span><span class='Task constant id'>Task</span><span class='lbrack token'>[</span><span class='symbol val'>:pak</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='invoke identifier id'>invoke</span>
2540
- <span class='packages identifier id'>packages</span> <span class='assign token'>=</span> <span class='Dir constant id'>Dir</span><span class='lbrack token'>[</span><span class='string val'>'pkg/*.[a-z]*'</span><span class='rbrack token'>]</span>
2541
-
2542
- <span class='unless unless kw'>unless</span> <span class='packages identifier id'>packages</span><span class='dot token'>.</span><span class='empty? fid id'>empty?</span>
2543
- <span class='comment val'># NOTE: use the 'add_release' command ONLY for the first</span>
2544
- <span class='comment val'># file because it creates a new sub-section on the</span>
2545
- <span class='comment val'># RubyForge download page; we do not want one package</span>
2546
- <span class='comment val'># per sub-section on the RubyForge download page!</span>
2547
- <span class='comment val'>#</span>
2548
- <span class='uploader identifier id'>uploader</span><span class='lbrack token'>[</span><span class='symbol val'>:add_release</span><span class='comma token'>,</span> <span class='packages identifier id'>packages</span><span class='dot token'>.</span><span class='shift identifier id'>shift</span><span class='rbrack token'>]</span>
2549
-
2550
- <span class='unless unless kw'>unless</span> <span class='packages identifier id'>packages</span><span class='dot token'>.</span><span class='empty? fid id'>empty?</span>
2551
- <span class='uploader identifier id'>uploader</span><span class='lbrack token'>[</span><span class='symbol val'>:add_file</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='packages identifier id'>packages</span><span class='rbrack token'>]</span>
2552
- <span class='end end kw'>end</span>
2553
-
2554
- <span class='puts identifier id'>puts</span> <span class='string val'>&quot;Successfully published release packages to RubyForge.&quot;</span>
2555
- <span class='end end kw'>end</span>
2556
- <span class='end end kw'>end</span>
2557
- <span class='end end kw'>end</span>
2558
- <span class='end end kw'>end</span>
2559
- </pre>
2560
- </td>
2561
- </tr>
2562
- </table>
2563
- </div>
2564
- </div>
2565
- </div>
2566
- </div>
2567
-
2568
- </div>
2569
- </div>
2570
-
2571
- </div>
2572
- </div>
2573
- </body>
2574
- </html>