inochi 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2008 Suraj N. Kurapati <sunaku@gmail.com>
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any
4
+ purpose with or without fee is hereby granted, provided that the above
5
+ copyright notice and this permission notice appear in all copies.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
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
data/bin/inochi ADDED
@@ -0,0 +1,413 @@
1
+ #!/usr/bin/ruby -w
2
+ #
3
+ # Progress indicators:
4
+ #
5
+ # create: A file is being created because it does not exist.
6
+ #
7
+ # skip: A file is being skipped because it is already up to date.
8
+ #
9
+ # update: A file will be updated because it is out of date. A text
10
+ # merging tool (see the "--merger" option) will be launched to
11
+ # transfer content from the old file (*.old) and the new file
12
+ # (*.new) to the out of date file. If a text merging tool is
13
+ # not specified, then you will have to do the merging by hand.
14
+ #
15
+ # Usage:
16
+ #
17
+ # inochi [Option...] ModuleName
18
+ #
19
+
20
+ # command line
21
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'inochi')
22
+
23
+ @options = Inochi.main :Inochi do
24
+ opt :merger, 'A command that invokes a text merging tool with three arguments: (1) old file, (2) new file, (3) output file. The command should write the result of merging the old file and the new file to the output file. The command may only modify the output file; it must NOT modify the old file or the new file.', :type => :string
25
+ end
26
+
27
+ # utility logic
28
+ require 'fileutils'
29
+ require 'digest/sha1'
30
+
31
+ # Notify the user about some action being performed.
32
+ def notify *args # :nodoc:
33
+ printf "%8s %s\n", *args
34
+ end
35
+
36
+ # Writes the given contents to the file at the given path. If the given path
37
+ # already exists, then a backup is created before invoking the merging tool.
38
+ def create path, body, merger = @options[:merger]
39
+ # remove leading space
40
+ body = body.to_s
41
+ data = body.strip.gsub(/^#{body[/^[ \t]*(?=\S)/]}/, '') << "\n"
42
+
43
+ if File.exist? path
44
+ old_digest = Digest::SHA1.digest(File.read(path))
45
+ new_digest = Digest::SHA1.digest(data)
46
+
47
+ if old_digest == new_digest
48
+ notify :skip, path
49
+ else
50
+ notify :update, path
51
+ cur, old, new = path, "#{path}.old", "#{path}.new"
52
+
53
+ FileUtils.cp cur, old, :preserve => true
54
+ File.write new, data
55
+
56
+ system merger, old, new, cur if merger
57
+ end
58
+ else
59
+ notify :create, path
60
+ FileUtils.mkdir_p File.dirname(path)
61
+ File.write path, data
62
+ end
63
+ end
64
+
65
+ # program body
66
+ target = ARGV.shift or
67
+ raise ArgumentError, "Project was not specified. Run `#{$0} -h` for help."
68
+
69
+ project = Inochi.calc_project_symbol(target)
70
+ program = Inochi.calc_program_name(project)
71
+ version = '0.0.0'
72
+ release = Time.now.strftime('%F')
73
+
74
+ preamble = %{
75
+ require 'rubygems'
76
+ gem '#{Inochi::PROGRAM}', '~> #{Inochi::VERSION[/^\d+/]}'
77
+ require '#{Inochi::PROGRAM}'
78
+ }.strip
79
+
80
+ create "#{program}/LICENSE", %{
81
+ Copyright #{Time.now.year} Your Name <your@email.here>
82
+
83
+ Permission to use, copy, modify, and/or distribute this software for any
84
+ purpose with or without fee is hereby granted, provided that the above
85
+ copyright notice and this permission notice appear in all copies.
86
+
87
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
88
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
89
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
90
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
91
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
92
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
93
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
94
+ }
95
+
96
+ create "#{program}/Rakefile", %{
97
+ #{preamble}
98
+
99
+ Inochi.rake #{project.inspect} do |gem|
100
+ # TODO: additional gem configuration.
101
+ # NOTE: this is completely optional!
102
+ #
103
+ # gem.extensions = ['foo.so']
104
+ # gem.files += ['other', 'files']
105
+ end
106
+ }
107
+
108
+ bin_file = "#{program}/bin/#{program}"
109
+ create bin_file, %{
110
+ #!/usr/bin/ruby -w
111
+ #
112
+ # TODO: Explain the command-line usage of this program here.
113
+ #
114
+ # Usage:
115
+ #
116
+ # #{program} [Option...] Arg1 Arg2 Arg3...
117
+ #
118
+
119
+ #{preamble}
120
+
121
+ options = Inochi.main #{project.inspect} do
122
+ # TODO: define command-line options here.
123
+ # see http://trollop.rubyforge.org/
124
+ #
125
+ # NOTE: this is completely optional!
126
+ end
127
+
128
+ # TODO: add the body of your program here
129
+
130
+ puts "Command-line options: \#{options.inspect}"
131
+ puts "Command-line arguments: \#{ARGV.inspect}"
132
+ }
133
+ FileUtils.chmod 0755, bin_file
134
+
135
+ create "#{program}/lib/#{program}.rb", %{
136
+ #{preamble}
137
+
138
+ Inochi.init #{project.inspect},
139
+ :project => '#{target}',
140
+ :version => '#{version}',
141
+ :release => '#{release}',
142
+ :website => 'http://#{program}.rubyforge.org',
143
+ :tagline => 'TODO: put a single line description of your project here.',
144
+ :require => {
145
+ # TODO: list gems required by your project here.
146
+ # NOTE: this is completely optional!
147
+ #
148
+ # example: if your project needs version 9.9.9 of the 'foo' gem:
149
+ # 'foo' => '9.9.9',
150
+ #
151
+ # example: if any version of a gem is acceptable then:
152
+ # 'foo' => nil,
153
+ }
154
+ }
155
+
156
+ create "#{program}/doc/index.erb", %{
157
+ <% Inochi.book #{project.inspect}, self %>
158
+
159
+ <%# include intro.erb #%>
160
+ <%# include setup.erb #%>
161
+ <%# include theory.erb #%>
162
+ <%# include usage.erb #%>
163
+ <%# include history.erb #%>
164
+ }
165
+
166
+ create "#{program}/doc/intro.erb", %{
167
+ <% chapter "Introduction" do %>
168
+ <% project_summary do %>
169
+ > TODO: explain the purpose of your project
170
+
171
+ ****<%= $project %>**** is a __________ that __________.
172
+ <% end %>
173
+
174
+ > TODO: explain why your project is important
175
+
176
+ **<%= $project %>** is exciting because:
177
+ * It lets you __________.
178
+ * Its core contains less than __________ lines of code.
179
+ * It __________.
180
+
181
+ > TODO: explain why your project is better than its competitors
182
+
183
+ These features distinguish **<%= $project %>** from the competition:
184
+ * [competitor 1](http://)
185
+ * [competitor 2](http://)
186
+ * [competitor 3](http://)
187
+
188
+ <% paragraph "Etymology" do %>
189
+ > TODO: explain the meaning of the name of your project
190
+ <% end %>
191
+
192
+ <% section "Logistics" do %>
193
+ * <%= xref "History", "Release notes" %> --- history of project releases.
194
+ * [Source code](http://github.com/#{ENV['USER']}/<%= $program %>) --- obtain via [Git](http://git.or.cz) or browse online.
195
+ * [API reference](api/index.html) --- documentation for source code.
196
+
197
+ To get help or provide feedback, simply
198
+ <%= xref "License", "contact the author(s)" %>.
199
+
200
+ <% paragraph "Version numbers" do %>
201
+ **<%= $project %>** releases are numbered in *major.minor.patch*
202
+ form according to the [RubyGems rational versioning
203
+ policy](http://www.rubygems.org/read/chapter/7), which
204
+ can be summarized thus:
205
+
206
+ <table markdown="1">
207
+ <thead>
208
+ <tr>
209
+ <td rowspan="2">What increased in the version number?</td>
210
+ <td colspan="3">The increase indicates that the release:</td>
211
+ </tr>
212
+ <tr>
213
+ <th>Is backward compatible?</th>
214
+ <th>Has new features?</th>
215
+ <th>Has bug fixes?</th>
216
+ </tr>
217
+ </thead>
218
+ <tbody>
219
+ <tr>
220
+ <th>major</th>
221
+ <td style="background-color: #FFE4E1;">No</td>
222
+ <td>Yes</td>
223
+ <td>Yes</td>
224
+ </tr>
225
+ <tr>
226
+ <th>minor</th>
227
+ <td>Yes</td>
228
+ <td>Yes</td>
229
+ <td>Yes</td>
230
+ </tr>
231
+ <tr>
232
+ <th>patch</th>
233
+ <td>Yes</td>
234
+ <td style="background-color: #FFE4E1;">No</td>
235
+ <td>Yes</td>
236
+ </tr>
237
+ </tbody>
238
+ </table>
239
+ <% end %>
240
+ <% end %>
241
+
242
+ <% section "License" do %>
243
+ <%# include ../LICENSE #%>
244
+ <% end %>
245
+
246
+ <% section "Credits" do %>
247
+ > TODO: give attribution to your predecessors and contributors
248
+ <% end %>
249
+ <% end %>
250
+ }
251
+
252
+ create "#{program}/doc/setup.erb", %{
253
+ <% chapter "Setup" do %>
254
+ <% section "Requirements" do %>
255
+ Your system needs the following software to run **<%= $project %>**.
256
+
257
+ | Software | Description | Notes |
258
+ | -------- | ----------- | ----- |
259
+ | [Ruby](http://ruby-lang.org) | Ruby language interpreter | Version #{RUBY_VERSION} is required. |
260
+ | [RubyGems](http://rubygems.org) | Ruby packaging system | Version #{`gem --version`.chomp} is required. |
261
+ <% end %>
262
+
263
+ <% section "Installation" do %>
264
+ You can install **<%= $project %>** by running this command:
265
+
266
+ gem install <%= $program %>
267
+
268
+ To check whether the installation was sucessful, run this command:
269
+
270
+ <%= $program %> --version
271
+
272
+ If the installation was successful, you will see output like this:
273
+
274
+ <pre><%= verbatim `ruby bin/\#{$program} --version` %></pre>
275
+
276
+ If you do not see such output, you may
277
+ <%= xref "License", "ask the author(s)" %> for help.
278
+ <% end %>
279
+
280
+ <% section "Manifest" do %>
281
+ You will see the following items inside **<%= $project %>**'s installation
282
+ directory, whose path you can determine by running this command:
283
+
284
+ <%= $program %> --version
285
+
286
+ > TODO: list important files your project provides here
287
+
288
+ * <tt>bin/</tt>
289
+
290
+ * <tt><%= $program %></tt> --- the main **<%= $project %>** executable.
291
+
292
+ * <tt>lib/</tt>
293
+
294
+ * <tt><%= $program %>.rb</tt> --- the main **<%= $project %>** library.
295
+
296
+ * <tt><%= $program %>/</tt>
297
+
298
+ > TODO: list sub-libraries your project provides here
299
+
300
+ * <tt>doc/</tt>
301
+
302
+ * <tt>api/</tt> --- API reference documentation.
303
+
304
+ * <tt>index.erb</tt> --- source of this user manual.
305
+
306
+ * <tt>LICENSE</tt> --- copyright notice and legal conditions.
307
+ <% end %>
308
+ <% end %>
309
+ }
310
+
311
+ create "#{program}/doc/theory.erb", %{
312
+ <% chapter "Theory of operation" do %>
313
+ > TODO: explain how your project does what it does
314
+ <% end %>
315
+ }
316
+
317
+ create "#{program}/doc/usage.erb", %{
318
+ <% chapter "Usage" do %>
319
+ <% section "Command-line interface" do %>
320
+ When you run this command:
321
+
322
+ <%= $program %> --help
323
+
324
+ You will see this output:
325
+
326
+ <pre><%= verbatim `ruby bin/\#{$program} --help` %></pre>
327
+
328
+ > TODO: explain the command-line arguments
329
+ <% end %>
330
+
331
+ <% section "Ruby library interface" do %>
332
+ > TODO: explain how to use your project's Ruby library
333
+ > from inside another Ruby program or library
334
+ <% end %>
335
+
336
+ <% section "Tutorial" do %>
337
+ This tutorial shows how **<%= $project %>** is used to __________.
338
+
339
+ > TODO: give examples for doing common tasks
340
+ <% end %>
341
+
342
+ > TODO: explain how to do more (advanced) things
343
+ <% end %>
344
+ }
345
+
346
+ create "#{program}/doc/history.erb", %{
347
+ <% chapter "History" do %>
348
+ > TODO: put a brief history about your project here
349
+
350
+ <% project_history do %>
351
+ > TODO: put release notes for your project
352
+ > here -- newest first, oldest last.
353
+
354
+ <% section "Version #{version} (#{release})" do %>
355
+ > TODO: write a short summary of the changes in this release
356
+
357
+ This release changes __________, adds __________, and fixes __________.
358
+
359
+ <% paragraph "Contributor kudos" do %>
360
+ > TODO: list everyone who contributed to this
361
+ > release and what their contribution was
362
+
363
+ * __________ contributed __________ which __________.
364
+
365
+ * __________ fixed __________ which __________.
366
+
367
+ * __________ added __________ which __________.
368
+ <% end %>
369
+
370
+ <% paragraph "Incompatible changes" do %>
371
+ > TODO: list all backward-incompatible changes in this release
372
+
373
+ * __________ has been __________ to __________.
374
+
375
+ * __________.
376
+
377
+ * __________.
378
+ <% end %>
379
+
380
+ <% paragraph "New features" do %>
381
+ > TODO: list new features added in this release
382
+
383
+ * __________.
384
+
385
+ * __________.
386
+
387
+ * __________.
388
+ <% end %>
389
+
390
+ <% paragraph "Bug fixes" do %>
391
+ > TODO: describe all bugs that are fixed in this release
392
+
393
+ * __________ was __________.
394
+
395
+ * __________ were __________.
396
+
397
+ * __________ did __________.
398
+ <% end %>
399
+
400
+ <% paragraph "Housekeeping" do %>
401
+ > TODO: list the refactorings, clean ups, and other
402
+ > improvements that were done for this release
403
+
404
+ * __________.
405
+
406
+ * __________.
407
+
408
+ * __________.
409
+ <% end %>
410
+ <% end %>
411
+ <% end %>
412
+ <% end %>
413
+ }
data/doc/README ADDED
@@ -0,0 +1,6 @@
1
+ The "inochi.png" image and its "inochi.svg" source utilize the
2
+ ["3 flowers"][1] graphic, which was created and released into
3
+ the public domain by [Peileppe Production][2] on June 25, 2008.
4
+
5
+ [1]: http://openclipart.org/media/files/Peileppe/8978
6
+ [2]: http://openclipart.org/media/people/Peileppe
@@ -0,0 +1,2337 @@
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
+ 887
245
+ 888
246
+ 889
247
+ 890
248
+ 891
249
+ 892
250
+ 893
251
+ 894
252
+ 895
253
+ 896
254
+ 897
255
+ 898
256
+ 899
257
+ 900
258
+ 901
259
+ 902
260
+ 903
261
+ 904
262
+ 905
263
+ 906
264
+ 907
265
+ 908
266
+ 909
267
+ 910
268
+ 911
269
+ 912
270
+ 913
271
+ 914
272
+ 915
273
+ 916
274
+ 917
275
+ 918
276
+ 919
277
+ 920
278
+ 921
279
+ 922
280
+ 923
281
+ 924
282
+ 925</pre>
283
+ </td>
284
+ <td>
285
+ <pre class="code"><span class="info file"># File 'lib/inochi/inochi.rb', line 887</span>
286
+
287
+ <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>
288
+ <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>
289
+
290
+ <span class='comment val'># provide project constants as global variables to the user manual</span>
291
+ <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>
292
+ <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>
293
+ <span class='end end kw'>end</span>
294
+
295
+ <span class='comment val'># set document parameters for the user manual</span>
296
+ <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>
297
+ <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>
298
+ <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>
299
+ <span class='$authors gvar id'>$authors</span> <span class='assign token'>=</span> <span class='Hash constant id'>Hash</span><span class='lbrack token'>[</span>
300
+ <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>
301
+ <span class='comment val'># convert raw e-mail addresses into URLs for the erbook XHTML format</span>
302
+ <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>
303
+
304
+ <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>
305
+ <span class='end end kw'>end</span><span class='dot token'>.</span><span class='flatten identifier id'>flatten</span>
306
+ <span class='rbrack token'>]</span>
307
+
308
+ <span class='class class kw'>class</span> <span class='lshft op'>&lt;&lt;</span> <span class='book_template identifier id'>book_template</span>
309
+ <span class='def def kw'>def</span> <span class='project_summary identifier id'>project_summary</span>
310
+ <span class='raise identifier id'>raise</span> <span class='ArgumentError constant id'>ArgumentError</span><span class='comma token'>,</span> <span class='string val'>'block must be given'</span> <span class='unless unless_mod kw'>unless</span> <span class='block_given? fid id'>block_given?</span>
311
+ <span class='node identifier id'>node</span> <span class='do do kw'>do</span>
312
+ <span class='$project_summary_node gvar id'>$project_summary_node</span> <span class='assign token'>=</span> <span class='@nodes ivar id'>@nodes</span><span class='dot token'>.</span><span class='last identifier id'>last</span>
313
+ <span class='yield yield kw'>yield</span>
314
+ <span class='end end kw'>end</span>
315
+ <span class='end end kw'>end</span>
316
+
317
+ <span class='def def kw'>def</span> <span class='project_history identifier id'>project_history</span>
318
+ <span class='raise identifier id'>raise</span> <span class='ArgumentError constant id'>ArgumentError</span><span class='comma token'>,</span> <span class='string val'>'block must be given'</span> <span class='unless unless_mod kw'>unless</span> <span class='block_given? fid id'>block_given?</span>
319
+ <span class='node identifier id'>node</span> <span class='do do kw'>do</span>
320
+ <span class='$project_history_node gvar id'>$project_history_node</span> <span class='assign token'>=</span> <span class='@nodes ivar id'>@nodes</span><span class='dot token'>.</span><span class='last identifier id'>last</span>
321
+ <span class='yield yield kw'>yield</span>
322
+ <span class='end end kw'>end</span>
323
+ <span class='end end kw'>end</span>
324
+ <span class='end end kw'>end</span>
325
+ <span class='end end kw'>end</span>
326
+ </pre>
327
+ </td>
328
+ </tr>
329
+ </table>
330
+ </div>
331
+ </div>
332
+ </div>
333
+ </div>
334
+
335
+ <div class="method">
336
+ <div class="method_header">
337
+ <h3>calc_program_name</h3>
338
+ </div><div id="calc_program_name-class_method" class="section method">
339
+ <div class="details_title">
340
+ <div class='section methodsignature'>
341
+ <tt class='def'>
342
+ <span class='visibility'>public</span>
343
+ <span class='return_types'></span>
344
+ <span class='name'>calc_program_name</span><span class='args'>(project_symbol)</span>
345
+ <span class='block'></span>
346
+ </tt>
347
+ </div>
348
+
349
+ </div><div class="section docstring">
350
+ <p>
351
+ Returns the name of the main program executable, which is the same as the
352
+ project name fully in lowercase.
353
+ </p>
354
+
355
+ </div><div class="section source">
356
+ <span>[<a class="source_link" href="#">View source</a>]</span>
357
+ <div class="source_code">
358
+ <table>
359
+ <tr>
360
+ <td>
361
+ <pre class="lines">
362
+
363
+
364
+ 931
365
+ 932
366
+ 933</pre>
367
+ </td>
368
+ <td>
369
+ <pre class="code"><span class="info file"># File 'lib/inochi/inochi.rb', line 931</span>
370
+
371
+ <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>
372
+ <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>
373
+ <span class='end end kw'>end</span>
374
+ </pre>
375
+ </td>
376
+ </tr>
377
+ </table>
378
+ </div>
379
+ </div>
380
+ </div>
381
+ </div>
382
+
383
+ <div class="method">
384
+ <div class="method_header">
385
+ <h3>calc_project_symbol</h3>
386
+ </div><div id="calc_project_symbol-class_method" class="section method">
387
+ <div class="details_title">
388
+ <div class='section methodsignature'>
389
+ <tt class='def'>
390
+ <span class='visibility'>public</span>
391
+ <span class='return_types'></span>
392
+ <span class='name'>calc_project_symbol</span><span class='args'>(project_name)</span>
393
+ <span class='block'></span>
394
+ </tt>
395
+ </div>
396
+
397
+ </div><div class="section docstring">
398
+ <p>
399
+ Calculates the name of the project module from the given project name.
400
+ </p>
401
+
402
+ </div><div class="section source">
403
+ <span>[<a class="source_link" href="#">View source</a>]</span>
404
+ <div class="source_code">
405
+ <table>
406
+ <tr>
407
+ <td>
408
+ <pre class="lines">
409
+
410
+
411
+ 938
412
+ 939
413
+ 940
414
+ 941</pre>
415
+ </td>
416
+ <td>
417
+ <pre class="code"><span class="info file"># File 'lib/inochi/inochi.rb', line 938</span>
418
+
419
+ <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>
420
+ <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>
421
+ <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>
422
+ <span class='end end kw'>end</span>
423
+ </pre>
424
+ </td>
425
+ </tr>
426
+ </table>
427
+ </div>
428
+ </div>
429
+ </div>
430
+ </div>
431
+
432
+ <div class="method">
433
+ <div class="method_header">
434
+ <h3>camel_to_snake_case</h3>
435
+ </div><div id="camel_to_snake_case-class_method" class="section method">
436
+ <div class="details_title">
437
+ <div class='section methodsignature'>
438
+ <tt class='def'>
439
+ <span class='visibility'>public</span>
440
+ <span class='return_types'></span>
441
+ <span class='name'>camel_to_snake_case</span><span class='args'>(input)</span>
442
+ <span class='block'></span>
443
+ </tt>
444
+ </div>
445
+
446
+ </div><div class="section docstring">
447
+ <p>
448
+ Transforms the given input from CamelCase to snake_case.
449
+ </p>
450
+
451
+ </div><div class="section source">
452
+ <span>[<a class="source_link" href="#">View source</a>]</span>
453
+ <div class="source_code">
454
+ <table>
455
+ <tr>
456
+ <td>
457
+ <pre class="lines">
458
+
459
+
460
+ 946
461
+ 947
462
+ 948
463
+ 949
464
+ 950
465
+ 951
466
+ 952
467
+ 953
468
+ 954
469
+ 955
470
+ 956
471
+ 957
472
+ 958</pre>
473
+ </td>
474
+ <td>
475
+ <pre class="code"><span class="info file"># File 'lib/inochi/inochi.rb', line 946</span>
476
+
477
+ <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>
478
+ <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>
479
+
480
+ <span class='comment val'># handle camel case like FooBar =&gt; Foo_Bar</span>
481
+ <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>
482
+ <span class='end end kw'>end</span>
483
+
484
+ <span class='comment val'># handle abbreviations like XMLParser =&gt; XML_Parser</span>
485
+ <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>
486
+ <span class='end end kw'>end</span>
487
+
488
+ <span class='input identifier id'>input</span>
489
+ <span class='end end kw'>end</span>
490
+ </pre>
491
+ </td>
492
+ </tr>
493
+ </table>
494
+ </div>
495
+ </div>
496
+ </div>
497
+ </div>
498
+
499
+ <div class="method">
500
+ <div class="method_header">
501
+ <h3>init</h3>
502
+ </div><div id="init-class_method" class="section method">
503
+ <div class="details_title">
504
+ <div class='section methodsignature'>
505
+ <tt class='def'>
506
+ <span class='visibility'>public</span>
507
+ <span class='return_types'><tt>Module</tt></span>
508
+ <span class='name'>init</span><span class='args'>(project_symbol, project_config = )</span>
509
+ <span class='block'></span>
510
+ </tt>
511
+ </div>
512
+
513
+ </div><div class="section docstring">
514
+ <p>
515
+ Establishes your project in Ruby&#8217;s runtime environment by defining
516
+ the project module (which serves as a namespace for all code in the
517
+ project) and providing a common configuration for the project module:
518
+ </p>
519
+ <ul>
520
+ <li>Adds the project lib/ directory to the Ruby load path.
521
+
522
+ </li>
523
+ <li>Defines the INOCHI constant in the project module. This constant contains
524
+ the effective configuration parameters (@see project_config).
525
+
526
+ </li>
527
+ <li>Defines all configuration parameters as constants in the project module.
528
+
529
+ </li>
530
+ </ul>
531
+ <p>
532
+ This method must be invoked from immediately within (that is, not from
533
+ within any of its descendant directories) the project lib/ directory.
534
+ Ideally, this method would be invoked from the main project library.
535
+ </p>
536
+
537
+ </div><div class="section tags">
538
+ <h2>Meta Tags</h2>
539
+ <div class="param">
540
+ <h3>Parameters:</h3>
541
+ <dl>
542
+
543
+
544
+ <dt>
545
+ <span class='type'>[<tt>Symbol</tt>]</span>
546
+ <span class='name'>project_symbol</span>
547
+
548
+ </dt>
549
+ <dd>
550
+ <span class='desc'><p>
551
+ Name of the Ruby constant which serves as a namespace for the entire
552
+ project.
553
+ </p>
554
+ </span>
555
+ </dd>
556
+
557
+
558
+
559
+ <dt>
560
+ <span class='type'>[<tt>Hash</tt>]</span>
561
+ <span class='name'>project_config</span>
562
+
563
+ <em class="default">(defaults to: <tt></tt>)</em>
564
+
565
+ </dt>
566
+ <dd>
567
+ <span class='desc'><p>
568
+ Project configuration parameters:
569
+ </p>
570
+ <dl>
571
+ <dt>String</dt><dd>:project =&gt; Name of the project.
572
+
573
+ </dd>
574
+ </dl>
575
+ <p>
576
+ The default value is the value of the project_symbol parameter.
577
+ </p>
578
+ <dl>
579
+ <dt>String</dt><dd>:tagline =&gt; An enticing, single line description of the project.
580
+
581
+ </dd>
582
+ </dl>
583
+ <p>
584
+ The default value is an empty string.
585
+ </p>
586
+ <dl>
587
+ <dt>String</dt><dd>:website =&gt; URL of the published project website.
588
+
589
+ </dd>
590
+ </dl>
591
+ <p>
592
+ The default value is an empty string.
593
+ </p>
594
+ <dl>
595
+ <dt>String</dt><dd>:docsite =&gt; URL of the published user manual.
596
+
597
+ </dd>
598
+ </dl>
599
+ <p>
600
+ The default value is the same value as the :website parameter.
601
+ </p>
602
+ <dl>
603
+ <dt>String</dt><dd>:program =&gt; Name of the main project executable.
604
+
605
+ </dd>
606
+ </dl>
607
+ <p>
608
+ The default value is the value of the :project parameter in lowercase and
609
+ CamelCase converted into snake_case.
610
+ </p>
611
+ <dl>
612
+ <dt>String</dt><dd>:version =&gt; Version of the project.
613
+
614
+ </dd>
615
+ </dl>
616
+ <p>
617
+ The default value is &quot;0.0.0&quot;.
618
+ </p>
619
+ <dl>
620
+ <dt>String</dt><dd>:release =&gt; Date when this version was released.
621
+
622
+ </dd>
623
+ </dl>
624
+ <p>
625
+ The default value is the current time.
626
+ </p>
627
+ <dl>
628
+ <dt>String</dt><dd>:display =&gt; How the project name should be displayed.
629
+
630
+ </dd>
631
+ </dl>
632
+ <p>
633
+ The default value is the project name and version together.
634
+ </p>
635
+ <dl>
636
+ <dt>String</dt><dd>:install =&gt; Path to the directory which contains the project.
637
+
638
+ </dd>
639
+ </dl>
640
+ <p>
641
+ The default value is one directory above the parent directory of the file
642
+ from which this method was called.
643
+ </p>
644
+ <dl>
645
+ <dt>Hash</dt><dd>:require =&gt; The names and version constraints of ruby gems required by
646
+ this project. This information must be expressed as follows:
647
+
648
+ </dd>
649
+ </dl>
650
+ <ul>
651
+ <li>Each hash key must be the name of a ruby gem.
652
+
653
+ </li>
654
+ <li>Each hash value must be either <tt>nil</tt>, a single version number
655
+ requirement string (see Gem::Requirement) or an Array thereof.
656
+
657
+ </li>
658
+ </ul>
659
+ <p>
660
+ The default value is an empty Hash.
661
+ </p>
662
+ </span>
663
+ </dd>
664
+
665
+
666
+ </dl>
667
+ </div><div class="return">
668
+ <h3>Returns:</h3>
669
+ <dl>
670
+
671
+ <dt>
672
+
673
+ <span class='type'>[<tt>Module</tt>]</span>
674
+
675
+
676
+ <span class='name'></span>
677
+
678
+
679
+ </dt>
680
+ <dd>
681
+ <span class='desc'><p>
682
+ The newly configured project module.
683
+ </p>
684
+ </span>
685
+ </dd>
686
+
687
+ </dl>
688
+ </div>
689
+
690
+ </div><div class="section source">
691
+ <span>[<a class="source_link" href="#">View source</a>]</span>
692
+ <div class="source_code">
693
+ <table>
694
+ <tr>
695
+ <td>
696
+ <pre class="lines">
697
+
698
+
699
+ 88
700
+ 89
701
+ 90
702
+ 91
703
+ 92
704
+ 93
705
+ 94
706
+ 95
707
+ 96
708
+ 97
709
+ 98
710
+ 99
711
+ 100
712
+ 101
713
+ 102
714
+ 103
715
+ 104
716
+ 105
717
+ 106
718
+ 107
719
+ 108
720
+ 109
721
+ 110
722
+ 111
723
+ 112
724
+ 113
725
+ 114
726
+ 115
727
+ 116
728
+ 117
729
+ 118
730
+ 119
731
+ 120
732
+ 121
733
+ 122
734
+ 123
735
+ 124
736
+ 125
737
+ 126
738
+ 127
739
+ 128
740
+ 129
741
+ 130
742
+ 131
743
+ 132
744
+ 133
745
+ 134</pre>
746
+ </td>
747
+ <td>
748
+ <pre class="code"><span class="info file"># File 'lib/inochi/inochi.rb', line 88</span>
749
+
750
+ <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>
751
+ <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>
752
+
753
+ <span class='comment val'># this method is not re-entrant</span>
754
+ <span class='@already_seen ivar id'>@already_seen</span> <span class='opasgn op'>||=</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span>
755
+ <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>
756
+ <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>
757
+
758
+ <span class='comment val'># put project on Ruby load path</span>
759
+ <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>
760
+ <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>
761
+ <span class='$LOAD_PATH gvar id'>$LOAD_PATH</span><span class='dot token'>.</span><span class='unshift identifier id'>unshift</span> <span class='project_libs identifier id'>project_libs</span>
762
+
763
+ <span class='comment val'># supply configuration defaults</span>
764
+ <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>
765
+ <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>
766
+ <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>
767
+ <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>
768
+ <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>
769
+ <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>
770
+ <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>
771
+ <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>
772
+ <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>
773
+ <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>
774
+
775
+ <span class='comment val'># establish gem version dependencies and</span>
776
+ <span class='comment val'># sanitize the values while we're at it</span>
777
+ <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>
778
+ <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>
779
+
780
+ <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>
781
+ <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>
782
+ <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>
783
+
784
+ <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>
785
+ <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>
786
+ <span class='end end kw'>end</span>
787
+
788
+ <span class='comment val'># make configuration parameters available as constants</span>
789
+ <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>
790
+
791
+ <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>
792
+ <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>
793
+ <span class='end end kw'>end</span>
794
+
795
+ <span class='project_module identifier id'>project_module</span>
796
+ <span class='end end kw'>end</span>
797
+ </pre>
798
+ </td>
799
+ </tr>
800
+ </table>
801
+ </div>
802
+ </div>
803
+ </div>
804
+ </div>
805
+
806
+ <div class="method">
807
+ <div class="method_header">
808
+ <h3>main</h3>
809
+ </div><div id="main-class_method" class="section method">
810
+ <div class="details_title">
811
+ <div class='section methodsignature'>
812
+ <tt class='def'>
813
+ <span class='visibility'>public</span>
814
+ <span class='return_types'></span>
815
+ <span class='name'>main</span><span class='args'>(project_symbol, *trollop_args, &amp;trollop_config)</span>
816
+ <span class='block'></span>
817
+ </tt>
818
+ </div>
819
+
820
+ </div><div class="section docstring">
821
+ <p>
822
+ Provides a common configuration for the main project executable:
823
+ </p>
824
+ <ul>
825
+ <li>The program description (the sequence of non-blank lines at the top of the
826
+ file in which this method is invoked) is properly formatted and displayed
827
+ at the top of program&#8217;s help information.
828
+
829
+ </li>
830
+ <li>The program version information is fetched from the project module and
831
+ formatted in YAML fashion for easy consumption by other tools.
832
+
833
+ </li>
834
+ <li>A list of command-line options is displayed at the bottom of the
835
+ program&#8217;s help information.
836
+
837
+ </li>
838
+ </ul>
839
+
840
+ </div><div class="section tags">
841
+ <h2>Meta Tags</h2>
842
+ <div class="param">
843
+ <h3>Parameters:</h3>
844
+ <dl>
845
+
846
+
847
+ <dt>
848
+ <span class='type'>[<tt>Symbol</tt>]</span>
849
+ <span class='name'>project_symbol</span>
850
+
851
+ </dt>
852
+ <dd>
853
+ <span class='desc'><p>
854
+ Name of the Ruby constant which serves as a namespace for the entire
855
+ project.
856
+ </p>
857
+ </span>
858
+ </dd>
859
+
860
+
861
+ </dl>
862
+ </div><div class="return">
863
+ <h3>Returns:</h3>
864
+ <dl>
865
+
866
+ <dt>
867
+
868
+ <span class='type'>[<tt>Object</tt>]</span>
869
+
870
+
871
+ <span class='name'></span>
872
+
873
+
874
+ </dt>
875
+ <dd>
876
+ <span class='desc'><p>
877
+ The result of Trollop::options().
878
+ </p>
879
+ </span>
880
+ </dd>
881
+
882
+ </dl>
883
+ </div>
884
+
885
+ </div><div class="section source">
886
+ <span>[<a class="source_link" href="#">View source</a>]</span>
887
+ <div class="source_code">
888
+ <table>
889
+ <tr>
890
+ <td>
891
+ <pre class="lines">
892
+
893
+
894
+ 161
895
+ 162
896
+ 163
897
+ 164
898
+ 165
899
+ 166
900
+ 167
901
+ 168
902
+ 169
903
+ 170
904
+ 171
905
+ 172
906
+ 173
907
+ 174
908
+ 175
909
+ 176
910
+ 177
911
+ 178
912
+ 179
913
+ 180
914
+ 181
915
+ 182
916
+ 183
917
+ 184
918
+ 185
919
+ 186
920
+ 187
921
+ 188
922
+ 189
923
+ 190
924
+ 191
925
+ 192
926
+ 193
927
+ 194
928
+ 195
929
+ 196
930
+ 197
931
+ 198
932
+ 199
933
+ 200
934
+ 201
935
+ 202
936
+ 203</pre>
937
+ </td>
938
+ <td>
939
+ <pre class="code"><span class="info file"># File 'lib/inochi/inochi.rb', line 161</span>
940
+
941
+ <span class='def def kw'>def</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>
942
+ <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>
943
+ <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>
944
+
945
+ <span class='comment val'># load the project module</span>
946
+ <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>
947
+
948
+ <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>
949
+ <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>
950
+
951
+ <span class='comment val'># parse command-line options</span>
952
+ <span class='require identifier id'>require</span> <span class='string val'>'trollop'</span>
953
+
954
+ <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>
955
+
956
+ <span class='comment val'># show project description</span>
957
+ <span class='text identifier id'>text</span> <span class='dstring node'>&quot;#{project_module::PROJECT} - #{project_module::TAGLINE}&quot;</span>
958
+ <span class='text identifier id'>text</span> <span class='string val'>''</span>
959
+
960
+ <span class='comment val'># show program description</span>
961
+ <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>
962
+ <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>
963
+ <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>
964
+ <span class='text identifier id'>text</span> <span class='string val'>''</span>
965
+
966
+ <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>
967
+
968
+ <span class='comment val'># show version information</span>
969
+ <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>
970
+ <span class='dstring node'>&quot;#{c.downcase}: #{project_module.const_get c}&quot;</span>
971
+ <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>
972
+
973
+ <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>
974
+ <span class='end end kw'>end</span>
975
+
976
+ <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>
977
+ <span class='require identifier id'>require</span> <span class='string val'>'launchy'</span>
978
+ <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>
979
+ <span class='exit identifier id'>exit</span>
980
+ <span class='end end kw'>end</span>
981
+
982
+ <span class='options identifier id'>options</span>
983
+ <span class='end end kw'>end</span>
984
+ </pre>
985
+ </td>
986
+ </tr>
987
+ </table>
988
+ </div>
989
+ </div>
990
+ </div>
991
+ </div>
992
+
993
+ <div class="method">
994
+ <div class="method_header">
995
+ <h3>rake</h3>
996
+ </div><div id="rake-class_method" class="section method">
997
+ <div class="details_title">
998
+ <div class='section methodsignature'>
999
+ <tt class='def'>
1000
+ <span class='visibility'>public</span>
1001
+ <span class='return_types'></span>
1002
+ <span class='name'>rake</span><span class='args'>(project_symbol, options = )</span>
1003
+ <span class='block'>{|gem_spec| ... }</span>
1004
+ </tt>
1005
+ </div>
1006
+
1007
+ </div><div class="section docstring">
1008
+ <p>
1009
+ Provides Rake tasks for packaging, publishing, and announcing your project.
1010
+ </p>
1011
+ <ul>
1012
+ <li>An AUTHORS constant (which has the form &quot;[[name, info]]&quot; where
1013
+ &quot;name&quot; is the name of a copyright holder and &quot;info&quot; is
1014
+ their contact information) is added to the project module.
1015
+
1016
+ <p>
1017
+ This information is extracted from copyright notices in the project license
1018
+ file. NOTE that the first copyright notice must correspond to the primary
1019
+ project maintainer.
1020
+ </p>
1021
+ <p>
1022
+ Copyright notices must be in the following form:
1023
+ </p>
1024
+ <pre class="code">
1025
+ <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>
1026
+ </pre>
1027
+ <p>
1028
+ Where HOLDER is the name of the copyright holder, YEAR is the year when the
1029
+ copyright holder first began working on the project, and EMAIL is
1030
+ (optional) the email address of the copyright holder.
1031
+ </p>
1032
+ </li>
1033
+ </ul>
1034
+
1035
+ </div><div class="section tags">
1036
+ <h2>Meta Tags</h2>
1037
+ <div class="param">
1038
+ <h3>Parameters:</h3>
1039
+ <dl>
1040
+
1041
+
1042
+ <dt>
1043
+ <span class='type'>[<tt>Symbol</tt>]</span>
1044
+ <span class='name'>project_symbol</span>
1045
+
1046
+ </dt>
1047
+ <dd>
1048
+ <span class='desc'><p>
1049
+ Name of the Ruby constant which serves as a namespace for the entire
1050
+ project.
1051
+ </p>
1052
+ </span>
1053
+ </dd>
1054
+
1055
+
1056
+
1057
+ <dt>
1058
+ <span class='type'>[<tt>Hash</tt>]</span>
1059
+ <span class='name'>options</span>
1060
+
1061
+ <em class="default">(defaults to: <tt></tt>)</em>
1062
+
1063
+ </dt>
1064
+ <dd>
1065
+ <span class='desc'><p>
1066
+ Additional method parameters, which are all optional:
1067
+ </p>
1068
+ <dl>
1069
+ <dt>String</dt><dd>:license_file =&gt; Path (relative to the main project directory which
1070
+ contains the project Rakefile) to the file which contains the project
1071
+ license.
1072
+
1073
+ </dd>
1074
+ </dl>
1075
+ <p>
1076
+ The default value is &quot;LICENSE&quot;.
1077
+ </p>
1078
+ <dl>
1079
+ <dt>String</dt><dd>:logins_file =&gt; Path to the YAML file which contains login information
1080
+ for publishing release announcements.
1081
+
1082
+ </dd>
1083
+ </dl>
1084
+ <p>
1085
+ The default value is &quot;~/.config/inochi/logins.yaml&quot; where
1086
+ &quot;~&quot; is the path to your home directory.
1087
+ </p>
1088
+ <dl>
1089
+ <dt>String</dt><dd>:rubyforge_project =&gt; Name of the RubyForge project where release
1090
+ packages will be published.
1091
+
1092
+ </dd>
1093
+ </dl>
1094
+ <p>
1095
+ The default value is the value of the PROGRAM constant.
1096
+ </p>
1097
+ <dl>
1098
+ <dt>String</dt><dd>:rubyforge_section =&gt; Name of the RubyForge project&#8217;s File Release
1099
+ System section where release packages will be published.
1100
+
1101
+ </dd>
1102
+ </dl>
1103
+ <p>
1104
+ The default value is the value of the :rubyforge_project parameter.
1105
+ </p>
1106
+ <dl>
1107
+ <dt>String</dt><dd>:raa_project =&gt; Name of the RAA (Ruby Application Archive) entry for
1108
+ this project.
1109
+
1110
+ </dd>
1111
+ </dl>
1112
+ <p>
1113
+ The default value is the value of the PROGRAM constant.
1114
+ </p>
1115
+ <dl>
1116
+ <dt>String</dt><dd>:upload_target =&gt; Where to upload the project documentation. See
1117
+ &quot;destination&quot; in the rsync manual.
1118
+
1119
+ </dd>
1120
+ </dl>
1121
+ <p>
1122
+ The default value is nil.
1123
+ </p>
1124
+ <dl>
1125
+ <dt>String</dt><dd>:upload_delete =&gt; Delete unknown files at the upload target location?
1126
+
1127
+ </dd>
1128
+ </dl>
1129
+ <p>
1130
+ The default value is false.
1131
+ </p>
1132
+ <dl>
1133
+ <dt>Array</dt><dd>:upload_options =&gt; Additional command-line arguments to the rsync
1134
+ command.
1135
+
1136
+ </dd>
1137
+ </dl>
1138
+ <p>
1139
+ The default value is an empty array.
1140
+ </p>
1141
+ </span>
1142
+ </dd>
1143
+
1144
+
1145
+ </dl>
1146
+ </div><div class="yieldparam">
1147
+ <h3>Yield Parameters:</h3>
1148
+ <dl>
1149
+
1150
+ <dt>
1151
+
1152
+ <span class='type'>[<tt>Gem::Specification</tt>]</span>
1153
+
1154
+
1155
+ <span class='name'>gem_spec</span>
1156
+
1157
+
1158
+ </dt>
1159
+ <dd>
1160
+ <span class='desc'><p>
1161
+ the gem specification
1162
+ </p>
1163
+ </span>
1164
+ </dd>
1165
+
1166
+ </dl>
1167
+ </div>
1168
+
1169
+ </div><div class="section source">
1170
+ <span>[<a class="source_link" href="#">View source</a>]</span>
1171
+ <div class="source_code">
1172
+ <table>
1173
+ <tr>
1174
+ <td>
1175
+ <pre class="lines">
1176
+
1177
+
1178
+ 283
1179
+ 284
1180
+ 285
1181
+ 286
1182
+ 287
1183
+ 288
1184
+ 289
1185
+ 290
1186
+ 291
1187
+ 292
1188
+ 293
1189
+ 294
1190
+ 295
1191
+ 296
1192
+ 297
1193
+ 298
1194
+ 299
1195
+ 300
1196
+ 301
1197
+ 302
1198
+ 303
1199
+ 304
1200
+ 305
1201
+ 306
1202
+ 307
1203
+ 308
1204
+ 309
1205
+ 310
1206
+ 311
1207
+ 312
1208
+ 313
1209
+ 314
1210
+ 315
1211
+ 316
1212
+ 317
1213
+ 318
1214
+ 319
1215
+ 320
1216
+ 321
1217
+ 322
1218
+ 323
1219
+ 324
1220
+ 325
1221
+ 326
1222
+ 327
1223
+ 328
1224
+ 329
1225
+ 330
1226
+ 331
1227
+ 332
1228
+ 333
1229
+ 334
1230
+ 335
1231
+ 336
1232
+ 337
1233
+ 338
1234
+ 339
1235
+ 340
1236
+ 341
1237
+ 342
1238
+ 343
1239
+ 344
1240
+ 345
1241
+ 346
1242
+ 347
1243
+ 348
1244
+ 349
1245
+ 350
1246
+ 351
1247
+ 352
1248
+ 353
1249
+ 354
1250
+ 355
1251
+ 356
1252
+ 357
1253
+ 358
1254
+ 359
1255
+ 360
1256
+ 361
1257
+ 362
1258
+ 363
1259
+ 364
1260
+ 365
1261
+ 366
1262
+ 367
1263
+ 368
1264
+ 369
1265
+ 370
1266
+ 371
1267
+ 372
1268
+ 373
1269
+ 374
1270
+ 375
1271
+ 376
1272
+ 377
1273
+ 378
1274
+ 379
1275
+ 380
1276
+ 381
1277
+ 382
1278
+ 383
1279
+ 384
1280
+ 385
1281
+ 386
1282
+ 387
1283
+ 388
1284
+ 389
1285
+ 390
1286
+ 391
1287
+ 392
1288
+ 393
1289
+ 394
1290
+ 395
1291
+ 396
1292
+ 397
1293
+ 398
1294
+ 399
1295
+ 400
1296
+ 401
1297
+ 402
1298
+ 403
1299
+ 404
1300
+ 405
1301
+ 406
1302
+ 407
1303
+ 408
1304
+ 409
1305
+ 410
1306
+ 411
1307
+ 412
1308
+ 413
1309
+ 414
1310
+ 415
1311
+ 416
1312
+ 417
1313
+ 418
1314
+ 419
1315
+ 420
1316
+ 421
1317
+ 422
1318
+ 423
1319
+ 424
1320
+ 425
1321
+ 426
1322
+ 427
1323
+ 428
1324
+ 429
1325
+ 430
1326
+ 431
1327
+ 432
1328
+ 433
1329
+ 434
1330
+ 435
1331
+ 436
1332
+ 437
1333
+ 438
1334
+ 439
1335
+ 440
1336
+ 441
1337
+ 442
1338
+ 443
1339
+ 444
1340
+ 445
1341
+ 446
1342
+ 447
1343
+ 448
1344
+ 449
1345
+ 450
1346
+ 451
1347
+ 452
1348
+ 453
1349
+ 454
1350
+ 455
1351
+ 456
1352
+ 457
1353
+ 458
1354
+ 459
1355
+ 460
1356
+ 461
1357
+ 462
1358
+ 463
1359
+ 464
1360
+ 465
1361
+ 466
1362
+ 467
1363
+ 468
1364
+ 469
1365
+ 470
1366
+ 471
1367
+ 472
1368
+ 473
1369
+ 474
1370
+ 475
1371
+ 476
1372
+ 477
1373
+ 478
1374
+ 479
1375
+ 480
1376
+ 481
1377
+ 482
1378
+ 483
1379
+ 484
1380
+ 485
1381
+ 486
1382
+ 487
1383
+ 488
1384
+ 489
1385
+ 490
1386
+ 491
1387
+ 492
1388
+ 493
1389
+ 494
1390
+ 495
1391
+ 496
1392
+ 497
1393
+ 498
1394
+ 499
1395
+ 500
1396
+ 501
1397
+ 502
1398
+ 503
1399
+ 504
1400
+ 505
1401
+ 506
1402
+ 507
1403
+ 508
1404
+ 509
1405
+ 510
1406
+ 511
1407
+ 512
1408
+ 513
1409
+ 514
1410
+ 515
1411
+ 516
1412
+ 517
1413
+ 518
1414
+ 519
1415
+ 520
1416
+ 521
1417
+ 522
1418
+ 523
1419
+ 524
1420
+ 525
1421
+ 526
1422
+ 527
1423
+ 528
1424
+ 529
1425
+ 530
1426
+ 531
1427
+ 532
1428
+ 533
1429
+ 534
1430
+ 535
1431
+ 536
1432
+ 537
1433
+ 538
1434
+ 539
1435
+ 540
1436
+ 541
1437
+ 542
1438
+ 543
1439
+ 544
1440
+ 545
1441
+ 546
1442
+ 547
1443
+ 548
1444
+ 549
1445
+ 550
1446
+ 551
1447
+ 552
1448
+ 553
1449
+ 554
1450
+ 555
1451
+ 556
1452
+ 557
1453
+ 558
1454
+ 559
1455
+ 560
1456
+ 561
1457
+ 562
1458
+ 563
1459
+ 564
1460
+ 565
1461
+ 566
1462
+ 567
1463
+ 568
1464
+ 569
1465
+ 570
1466
+ 571
1467
+ 572
1468
+ 573
1469
+ 574
1470
+ 575
1471
+ 576
1472
+ 577
1473
+ 578
1474
+ 579
1475
+ 580
1476
+ 581
1477
+ 582
1478
+ 583
1479
+ 584
1480
+ 585
1481
+ 586
1482
+ 587
1483
+ 588
1484
+ 589
1485
+ 590
1486
+ 591
1487
+ 592
1488
+ 593
1489
+ 594
1490
+ 595
1491
+ 596
1492
+ 597
1493
+ 598
1494
+ 599
1495
+ 600
1496
+ 601
1497
+ 602
1498
+ 603
1499
+ 604
1500
+ 605
1501
+ 606
1502
+ 607
1503
+ 608
1504
+ 609
1505
+ 610
1506
+ 611
1507
+ 612
1508
+ 613
1509
+ 614
1510
+ 615
1511
+ 616
1512
+ 617
1513
+ 618
1514
+ 619
1515
+ 620
1516
+ 621
1517
+ 622
1518
+ 623
1519
+ 624
1520
+ 625
1521
+ 626
1522
+ 627
1523
+ 628
1524
+ 629
1525
+ 630
1526
+ 631
1527
+ 632
1528
+ 633
1529
+ 634
1530
+ 635
1531
+ 636
1532
+ 637
1533
+ 638
1534
+ 639
1535
+ 640
1536
+ 641
1537
+ 642
1538
+ 643
1539
+ 644
1540
+ 645
1541
+ 646
1542
+ 647
1543
+ 648
1544
+ 649
1545
+ 650
1546
+ 651
1547
+ 652
1548
+ 653
1549
+ 654
1550
+ 655
1551
+ 656
1552
+ 657
1553
+ 658
1554
+ 659
1555
+ 660
1556
+ 661
1557
+ 662
1558
+ 663
1559
+ 664
1560
+ 665
1561
+ 666
1562
+ 667
1563
+ 668
1564
+ 669
1565
+ 670
1566
+ 671
1567
+ 672
1568
+ 673
1569
+ 674
1570
+ 675
1571
+ 676
1572
+ 677
1573
+ 678
1574
+ 679
1575
+ 680
1576
+ 681
1577
+ 682
1578
+ 683
1579
+ 684
1580
+ 685
1581
+ 686
1582
+ 687
1583
+ 688
1584
+ 689
1585
+ 690
1586
+ 691
1587
+ 692
1588
+ 693
1589
+ 694
1590
+ 695
1591
+ 696
1592
+ 697
1593
+ 698
1594
+ 699
1595
+ 700
1596
+ 701
1597
+ 702
1598
+ 703
1599
+ 704
1600
+ 705
1601
+ 706
1602
+ 707
1603
+ 708
1604
+ 709
1605
+ 710
1606
+ 711
1607
+ 712
1608
+ 713
1609
+ 714
1610
+ 715
1611
+ 716
1612
+ 717
1613
+ 718
1614
+ 719
1615
+ 720
1616
+ 721
1617
+ 722
1618
+ 723
1619
+ 724
1620
+ 725
1621
+ 726
1622
+ 727
1623
+ 728
1624
+ 729
1625
+ 730
1626
+ 731
1627
+ 732
1628
+ 733
1629
+ 734
1630
+ 735
1631
+ 736
1632
+ 737
1633
+ 738
1634
+ 739
1635
+ 740
1636
+ 741
1637
+ 742
1638
+ 743
1639
+ 744
1640
+ 745
1641
+ 746
1642
+ 747
1643
+ 748
1644
+ 749
1645
+ 750
1646
+ 751
1647
+ 752
1648
+ 753
1649
+ 754
1650
+ 755
1651
+ 756
1652
+ 757
1653
+ 758
1654
+ 759
1655
+ 760
1656
+ 761
1657
+ 762
1658
+ 763
1659
+ 764
1660
+ 765
1661
+ 766
1662
+ 767
1663
+ 768
1664
+ 769
1665
+ 770
1666
+ 771
1667
+ 772
1668
+ 773
1669
+ 774
1670
+ 775
1671
+ 776
1672
+ 777
1673
+ 778
1674
+ 779
1675
+ 780
1676
+ 781
1677
+ 782
1678
+ 783
1679
+ 784
1680
+ 785
1681
+ 786
1682
+ 787
1683
+ 788
1684
+ 789
1685
+ 790
1686
+ 791
1687
+ 792
1688
+ 793
1689
+ 794
1690
+ 795
1691
+ 796
1692
+ 797
1693
+ 798
1694
+ 799
1695
+ 800
1696
+ 801
1697
+ 802
1698
+ 803
1699
+ 804
1700
+ 805
1701
+ 806
1702
+ 807
1703
+ 808
1704
+ 809
1705
+ 810
1706
+ 811
1707
+ 812
1708
+ 813
1709
+ 814
1710
+ 815
1711
+ 816
1712
+ 817
1713
+ 818
1714
+ 819
1715
+ 820
1716
+ 821
1717
+ 822
1718
+ 823
1719
+ 824
1720
+ 825
1721
+ 826
1722
+ 827
1723
+ 828
1724
+ 829
1725
+ 830
1726
+ 831
1727
+ 832
1728
+ 833
1729
+ 834
1730
+ 835
1731
+ 836
1732
+ 837
1733
+ 838
1734
+ 839
1735
+ 840
1736
+ 841
1737
+ 842
1738
+ 843
1739
+ 844
1740
+ 845
1741
+ 846
1742
+ 847
1743
+ 848
1744
+ 849
1745
+ 850
1746
+ 851
1747
+ 852</pre>
1748
+ </td>
1749
+ <td>
1750
+ <pre class="code"><span class="info file"># File 'lib/inochi/inochi.rb', line 283</span>
1751
+
1752
+ <span class='def def kw'>def</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>
1753
+ <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>
1754
+ <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>
1755
+
1756
+ <span class='comment val'># load the project module</span>
1757
+ <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>
1758
+
1759
+ <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='string val'>'lib'</span><span class='comma token'>,</span> <span class='program_name identifier id'>program_name</span><span class='rparen token'>)</span>
1760
+ <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>
1761
+
1762
+ <span class='comment val'># supply default options</span>
1763
+ <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>
1764
+ <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>
1765
+ <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>
1766
+ <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>
1767
+ <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><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='comma token'>,</span> <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><span class='rparen token'>)</span>
1768
+ <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>
1769
+ <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>
1770
+
1771
+ <span class='comment val'># add AUTHORS constant to the project module</span>
1772
+ <span class='license identifier id'>license</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='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>
1773
+
1774
+ <span class='copyright_holders identifier id'>copyright_holders</span> <span class='assign token'>=</span>
1775
+ <span class='license identifier id'>license</span><span class='dot token'>.</span><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>
1776
+ <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>
1777
+
1778
+ <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>
1779
+
1780
+ <span class='require identifier id'>require</span> <span class='string val'>'rake/clean'</span>
1781
+
1782
+ <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>
1783
+ <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>
1784
+ <span class='end end kw'>end</span>
1785
+
1786
+ <span class='comment val'># documentation</span>
1787
+ <span class='desc identifier id'>desc</span> <span class='string val'>'Build all documentation.'</span>
1788
+ <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>
1789
+
1790
+ <span class='comment val'># user manual</span>
1791
+ <span class='doc_man_src identifier id'>doc_man_src</span> <span class='assign token'>=</span> <span class='string val'>'doc/index.erb'</span>
1792
+ <span class='doc_man_dst identifier id'>doc_man_dst</span> <span class='assign token'>=</span> <span class='string val'>'doc/index.xhtml'</span>
1793
+ <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>
1794
+
1795
+ <span class='doc_man_doc identifier id'>doc_man_doc</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span>
1796
+ <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>
1797
+ <span class='unless unless kw'>unless</span> <span class='doc_man_doc identifier id'>doc_man_doc</span>
1798
+ <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>
1799
+ <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>
1800
+ <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>
1801
+ <span class='end end kw'>end</span>
1802
+ <span class='end end kw'>end</span>
1803
+
1804
+ <span class='desc identifier id'>desc</span> <span class='string val'>'Build the user manual.'</span>
1805
+ <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>
1806
+
1807
+ <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>
1808
+ <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>
1809
+ <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>
1810
+ <span class='end end kw'>end</span>
1811
+
1812
+ <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>
1813
+
1814
+ <span class='comment val'># API reference</span>
1815
+ <span class='doc_api_dst identifier id'>doc_api_dst</span> <span class='assign token'>=</span> <span class='string val'>'doc/api'</span>
1816
+
1817
+ <span class='desc identifier id'>desc</span> <span class='string val'>'Build API reference.'</span>
1818
+ <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>
1819
+
1820
+ <span class='require identifier id'>require</span> <span class='string val'>'yard'</span>
1821
+ <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>
1822
+ <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>
1823
+ <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>
1824
+ <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>
1825
+
1826
+ <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>
1827
+ <span class='end end kw'>end</span>
1828
+
1829
+ <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>
1830
+
1831
+ <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>
1832
+ <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>
1833
+
1834
+ <span class='comment val'># announcements</span>
1835
+ <span class='desc identifier id'>desc</span> <span class='string val'>'Build all release announcements.'</span>
1836
+ <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>
1837
+
1838
+ <span class='comment val'># it has long been a tradition to use an &quot;[ANN]&quot; prefix</span>
1839
+ <span class='comment val'># when announcing things on the ruby-talk mailing list</span>
1840
+ <span class='ann_prefix identifier id'>ann_prefix</span> <span class='assign token'>=</span> <span class='string val'>'[ANN] '</span>
1841
+ <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>
1842
+ <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>
1843
+
1844
+ <span class='comment val'># fetch the project summary from user manual</span>
1845
+ <span class='ann_nfo_doc identifier id'>ann_nfo_doc</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span>
1846
+ <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>
1847
+ <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>
1848
+ <span class='end end kw'>end</span>
1849
+
1850
+ <span class='comment val'># fetch release notes from user manual</span>
1851
+ <span class='ann_rel_doc identifier id'>ann_rel_doc</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span>
1852
+ <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>
1853
+ <span class='unless unless kw'>unless</span> <span class='ann_rel_doc identifier id'>ann_rel_doc</span>
1854
+ <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>
1855
+ <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>
1856
+ <span class='ann_rel_doc identifier id'>ann_rel_doc</span> <span class='assign token'>=</span> <span class='child identifier id'>child</span>
1857
+ <span class='else else kw'>else</span>
1858
+ <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>
1859
+ <span class='end end kw'>end</span>
1860
+ <span class='else else kw'>else</span>
1861
+ <span class='raise identifier id'>raise</span> <span class='string val'>'The user manual lacks a &quot;project_history&quot; node.'</span>
1862
+ <span class='end end kw'>end</span>
1863
+ <span class='end end kw'>end</span>
1864
+ <span class='end end kw'>end</span>
1865
+
1866
+ <span class='comment val'># build release notes in HTML and plain text</span>
1867
+ <span class='comment val'># converts the given HTML into plain text. we do this using</span>
1868
+ <span class='comment val'># lynx because (1) it outputs a list of all hyperlinks used</span>
1869
+ <span class='comment val'># in the HTML document and (2) it runs on all major platforms</span>
1870
+ <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>
1871
+ <span class='require identifier id'>require</span> <span class='string val'>'tempfile'</span>
1872
+
1873
+ <span class='begin begin kw'>begin</span>
1874
+ <span class='comment val'># lynx's -dump option requires a .html file</span>
1875
+ <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>
1876
+
1877
+ <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>
1878
+ <span class='text identifier id'>text</span> <span class='assign token'>=</span> <span class='dxstring node'>`lynx -dump #{tmp_file} -width 70`</span>
1879
+ <span class='ensure ensure kw'>ensure</span>
1880
+ <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>
1881
+ <span class='end end kw'>end</span>
1882
+
1883
+ <span class='comment val'># improve readability of list items that span multiple</span>
1884
+ <span class='comment val'># lines by adding a blank line between such items</span>
1885
+ <span class='text identifier id'>text</span><span class='dot token'>.</span><span class='gsub! fid id'>gsub!</span> <span class='regexp val'>%r{^( *[^\*\s].*)(\r?\n)( *\* \S)}</span><span class='comma token'>,</span> <span class='string val'>'\1\2\2\3'</span>
1886
+
1887
+ <span class='text identifier id'>text</span>
1888
+ <span class='end end kw'>end</span>
1889
+
1890
+ <span class='comment val'># binds relative addresses in the given HTML to the project docsite</span>
1891
+ <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>
1892
+ <span class='comment val'># resolve relative URLs into absolute URLs</span>
1893
+ <span class='comment val'># see http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax</span>
1894
+ <span class='require identifier id'>require</span> <span class='string val'>'addressable/uri'</span>
1895
+ <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>
1896
+ <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>
1897
+ <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>
1898
+
1899
+ <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>
1900
+ <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>
1901
+
1902
+ <span class='case case kw'>case</span> <span class='$3 nth_ref id'>$3</span>
1903
+ <span class='when when kw'>when</span> <span class='regexp val'>%r{^[[:alpha:]][[:alnum:]\+\.\-]*://}</span> <span class='comment val'># already absolute</span>
1904
+ <span class='match identifier id'>match</span>
1905
+
1906
+ <span class='when when kw'>when</span> <span class='regexp val'>/^#/</span>
1907
+ <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>
1908
+
1909
+ <span class='else else kw'>else</span>
1910
+ <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>
1911
+ <span class='end end kw'>end</span>
1912
+ <span class='end end kw'>end</span>
1913
+ <span class='end end kw'>end</span>
1914
+
1915
+ <span class='ann_html identifier id'>ann_html</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span>
1916
+ <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>
1917
+ <span class='unless unless kw'>unless</span> <span class='ann_html identifier id'>ann_html</span>
1918
+ <span class='ann_html identifier id'>ann_html</span> <span class='assign token'>=</span> <span class='dstring node'>%{
1919
+ &lt;center&gt;
1920
+ &lt;h1&gt;#{project_module::DISPLAY}&lt;/h1&gt;
1921
+ &lt;p&gt;#{project_module::TAGLINE}&lt;/p&gt;
1922
+ &lt;p&gt;#{project_module::WEBSITE}&lt;/p&gt;
1923
+ &lt;/center&gt;
1924
+ #{ann_nfo_doc}
1925
+ #{ann_rel_doc}
1926
+ }</span>
1927
+
1928
+ <span class='comment val'># remove heading navigation menus</span>
1929
+ <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>
1930
+
1931
+ <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>
1932
+ <span class='end end kw'>end</span>
1933
+ <span class='end end kw'>end</span>
1934
+
1935
+ <span class='ann_text identifier id'>ann_text</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span>
1936
+ <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>
1937
+ <span class='unless unless kw'>unless</span> <span class='ann_text identifier id'>ann_text</span>
1938
+ <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>
1939
+ <span class='end end kw'>end</span>
1940
+ <span class='end end kw'>end</span>
1941
+
1942
+ <span class='ann_nfo_text identifier id'>ann_nfo_text</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span>
1943
+ <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>
1944
+ <span class='unless unless kw'>unless</span> <span class='ann_nfo_text identifier id'>ann_nfo_text</span>
1945
+ <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>
1946
+ <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>
1947
+ <span class='end end kw'>end</span>
1948
+ <span class='end end kw'>end</span>
1949
+
1950
+ <span class='comment val'># HTML</span>
1951
+ <span class='ann_html_dst identifier id'>ann_html_dst</span> <span class='assign token'>=</span> <span class='string val'>'ANN.html'</span>
1952
+
1953
+ <span class='desc identifier id'>desc</span> <span class='dstring node'>&quot;Build HTML announcement: #{ann_html_dst}&quot;</span>
1954
+ <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>
1955
+
1956
+ <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>
1957
+ <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>
1958
+ <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>
1959
+ <span class='end end kw'>end</span>
1960
+
1961
+ <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>
1962
+
1963
+ <span class='comment val'># RSS feed</span>
1964
+ <span class='ann_feed_dst identifier id'>ann_feed_dst</span> <span class='assign token'>=</span> <span class='string val'>'doc/ann.xml'</span>
1965
+
1966
+ <span class='desc identifier id'>desc</span> <span class='dstring node'>&quot;Build RSS announcement: #{ann_feed_dst}&quot;</span>
1967
+ <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>
1968
+
1969
+ <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>
1970
+ <span class='require identifier id'>require</span> <span class='string val'>'time'</span>
1971
+ <span class='require identifier id'>require</span> <span class='string val'>'rss/maker'</span>
1972
+
1973
+ <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>
1974
+ <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>
1975
+ <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>
1976
+ <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>
1977
+
1978
+ <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>
1979
+ <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>
1980
+
1981
+ <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>
1982
+ <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>
1983
+ <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>
1984
+ <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>
1985
+ <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>
1986
+ <span class='end end kw'>end</span>
1987
+
1988
+ <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>
1989
+ <span class='end end kw'>end</span>
1990
+
1991
+ <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>
1992
+
1993
+ <span class='comment val'># plain text</span>
1994
+ <span class='ann_text_dst identifier id'>ann_text_dst</span> <span class='assign token'>=</span> <span class='string val'>'ANN.txt'</span>
1995
+
1996
+ <span class='desc identifier id'>desc</span> <span class='dstring node'>&quot;Build plain text announcement: #{ann_text_dst}&quot;</span>
1997
+ <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>
1998
+
1999
+ <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>
2000
+ <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>
2001
+ <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>
2002
+ <span class='end end kw'>end</span>
2003
+
2004
+ <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>
2005
+
2006
+ <span class='comment val'># e-mail</span>
2007
+ <span class='ann_mail_dst identifier id'>ann_mail_dst</span> <span class='assign token'>=</span> <span class='string val'>'ANN.eml'</span>
2008
+
2009
+ <span class='desc identifier id'>desc</span> <span class='dstring node'>&quot;Build e-mail announcement: #{ann_mail_dst}&quot;</span>
2010
+ <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>
2011
+
2012
+ <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>
2013
+ <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>
2014
+ <span class='require identifier id'>require</span> <span class='string val'>'time'</span>
2015
+ <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>
2016
+
2017
+ <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>
2018
+ <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>
2019
+ <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>
2020
+
2021
+ <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>
2022
+ <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>
2023
+ <span class='end end kw'>end</span>
2024
+ <span class='end end kw'>end</span>
2025
+
2026
+ <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>
2027
+
2028
+ <span class='comment val'># packaging</span>
2029
+ <span class='desc identifier id'>desc</span> <span class='string val'>'Build a release.'</span>
2030
+ <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>
2031
+ <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>
2032
+ <span class='end end kw'>end</span>
2033
+ <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>
2034
+
2035
+ <span class='comment val'># ruby gem</span>
2036
+ <span class='require identifier id'>require</span> <span class='string val'>'rake/gempackagetask'</span>
2037
+
2038
+ <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>
2039
+ <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>
2040
+
2041
+ <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>
2042
+ <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>
2043
+ <span class='end end kw'>end</span>
2044
+
2045
+ <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>
2046
+ <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>
2047
+ <span class='end end kw'>end</span>
2048
+
2049
+ <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>
2050
+
2051
+ <span class='comment val'># XXX: In theory, `gem.name` should be assigned to</span>
2052
+ <span class='comment val'># ::PROJECT instead of ::PROGRAM</span>
2053
+ <span class='comment val'>#</span>
2054
+ <span class='comment val'># In practice, PROJECT may contain non-word</span>
2055
+ <span class='comment val'># characters and may also contain a mixture</span>
2056
+ <span class='comment val'># of lowercase and uppercase letters.</span>
2057
+ <span class='comment val'>#</span>
2058
+ <span class='comment val'># This makes it difficult for people to</span>
2059
+ <span class='comment val'># install the project gem because they must</span>
2060
+ <span class='comment val'># remember the exact spelling used in</span>
2061
+ <span class='comment val'># `gem.name` when running `gem install ____`.</span>
2062
+ <span class='comment val'>#</span>
2063
+ <span class='comment val'># For example, consider the &quot;RedCloth&quot; gem.</span>
2064
+ <span class='comment val'>#</span>
2065
+ <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>
2066
+
2067
+ <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>
2068
+ <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>
2069
+ <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>
2070
+ <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>
2071
+ <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>
2072
+ <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>
2073
+ <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>
2074
+
2075
+ <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>
2076
+ <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>
2077
+ <span class='end end kw'>end</span>
2078
+
2079
+ <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>
2080
+ <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>
2081
+ <span class='end end kw'>end</span>
2082
+
2083
+ <span class='comment val'># additional configuration is done by user</span>
2084
+ <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>
2085
+ <span class='end end kw'>end</span>
2086
+
2087
+ <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>
2088
+
2089
+ <span class='comment val'># XXX: hide the tasks defined by the above gem packaging library</span>
2090
+ <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>
2091
+
2092
+ <span class='comment val'># releasing</span>
2093
+ <span class='desc identifier id'>desc</span> <span class='string val'>'Publish a release.'</span>
2094
+ <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>
2095
+
2096
+ <span class='comment val'># connect to RubyForge services</span>
2097
+ <span class='pub_forge identifier id'>pub_forge</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span>
2098
+ <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>
2099
+ <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>
2100
+
2101
+ <span class='task identifier id'>task</span> <span class='symbol val'>:pub_forge</span> <span class='do do kw'>do</span>
2102
+ <span class='require identifier id'>require</span> <span class='string val'>'rubyforge'</span>
2103
+ <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>
2104
+ <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>
2105
+
2106
+ <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>
2107
+ <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>
2108
+ <span class='end end kw'>end</span>
2109
+
2110
+ <span class='pub_forge identifier id'>pub_forge</span><span class='dot token'>.</span><span class='login identifier id'>login</span>
2111
+ <span class='end end kw'>end</span>
2112
+
2113
+ <span class='comment val'># documentation</span>
2114
+ <span class='desc identifier id'>desc</span> <span class='string val'>'Publish documentation to project website.'</span>
2115
+ <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>
2116
+ <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>
2117
+
2118
+ <span class='unless unless kw'>unless</span> <span class='target identifier id'>target</span>
2119
+ <span class='require identifier id'>require</span> <span class='string val'>'addressable/uri'</span>
2120
+ <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>
2121
+
2122
+ <span class='comment val'># provide uploading capability to websites hosted on RubyForge</span>
2123
+ <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>
2124
+ <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>
2125
+ <span class='end end kw'>end</span>
2126
+ <span class='end end kw'>end</span>
2127
+
2128
+ <span class='if if kw'>if</span> <span class='target identifier id'>target</span>
2129
+ <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>
2130
+ <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>
2131
+ <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>
2132
+
2133
+ <span class='p identifier id'>p</span> <span class='cmd identifier id'>cmd</span>
2134
+ <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>
2135
+ <span class='end end kw'>end</span>
2136
+ <span class='end end kw'>end</span>
2137
+
2138
+ <span class='comment val'># announcement</span>
2139
+ <span class='desc identifier id'>desc</span> <span class='string val'>'Publish all announcements.'</span>
2140
+ <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>
2141
+
2142
+ <span class='comment val'># login information</span>
2143
+ <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>
2144
+ <span class='ann_logins identifier id'>ann_logins</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span>
2145
+
2146
+ <span class='task identifier id'>task</span> <span class='symbol val'>:ann_logins</span> <span class='do do kw'>do</span>
2147
+ <span class='ann_logins identifier id'>ann_logins</span> <span class='assign token'>=</span> <span class='begin begin kw'>begin</span>
2148
+ <span class='require identifier id'>require</span> <span class='string val'>'yaml'</span>
2149
+ <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>
2150
+ <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>
2151
+ <span class='warn identifier id'>warn</span> <span class='dstring node'>&quot;Could not read login information from #{ann_logins_file.inspect}:&quot;</span>
2152
+ <span class='warn identifier id'>warn</span> <span class='e identifier id'>e</span>
2153
+ <span class='warn identifier id'>warn</span> <span class='string val'>&quot;** You will NOT be able to publish release announcements! **&quot;</span>
2154
+ <span class='lbrace token'>{</span><span class='rbrace token'>}</span>
2155
+ <span class='end end kw'>end</span>
2156
+ <span class='end end kw'>end</span>
2157
+
2158
+ <span class='desc identifier id'>desc</span> <span class='string val'>'Announce to RubyForge news.'</span>
2159
+ <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>
2160
+ <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>
2161
+
2162
+ <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>
2163
+ <span class='comment val'># check if this release was already announced</span>
2164
+ <span class='require identifier id'>require</span> <span class='string val'>'mechanize'</span>
2165
+ <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>
2166
+ <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>
2167
+
2168
+ <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>
2169
+
2170
+ <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>
2171
+
2172
+ <span class='if if kw'>if</span> <span class='already_announced identifier id'>already_announced</span>
2173
+ <span class='warn identifier id'>warn</span> <span class='string val'>&quot;This release was already announced to RubyForge news, so I will NOT announce it there again.&quot;</span>
2174
+ <span class='else else kw'>else</span>
2175
+ <span class='comment val'># make the announcement</span>
2176
+ <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>
2177
+ <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>
2178
+
2179
+ <span class='puts identifier id'>puts</span> <span class='string val'>&quot;Successfully announced to RubyForge news:&quot;</span>
2180
+ <span class='puts identifier id'>puts</span> <span class='page identifier id'>page</span><span class='dot token'>.</span><span class='uri identifier id'>uri</span>
2181
+ <span class='end end kw'>end</span>
2182
+ <span class='else else kw'>else</span>
2183
+ <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>
2184
+ <span class='end end kw'>end</span>
2185
+ <span class='end end kw'>end</span>
2186
+
2187
+ <span class='desc identifier id'>desc</span> <span class='string val'>'Announce to ruby-talk mailing list.'</span>
2188
+ <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>
2189
+ <span class='host identifier id'>host</span> <span class='assign token'>=</span> <span class='string val'>'http://ruby-forum.com'</span>
2190
+ <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>
2191
+
2192
+ <span class='require identifier id'>require</span> <span class='string val'>'mechanize'</span>
2193
+ <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>
2194
+
2195
+ <span class='comment val'># check if this release was already announced</span>
2196
+ <span class='already_announced identifier id'>already_announced</span> <span class='assign token'>=</span>
2197
+ <span class='begin begin kw'>begin</span>
2198
+ <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>
2199
+
2200
+ <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>
2201
+ <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>
2202
+ <span class='rescue rescue kw'>rescue</span>
2203
+ <span class='false false kw'>false</span>
2204
+ <span class='end end kw'>end</span>
2205
+
2206
+ <span class='if if kw'>if</span> <span class='already_announced identifier id'>already_announced</span>
2207
+ <span class='warn identifier id'>warn</span> <span class='string val'>&quot;This release was already announced to the ruby-talk mailing list, so I will NOT announce it there again.&quot;</span>
2208
+ <span class='else else kw'>else</span>
2209
+ <span class='comment val'># log in to RubyForum</span>
2210
+ <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>
2211
+ <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>
2212
+
2213
+ <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>
2214
+ <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>
2215
+ <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>
2216
+ <span class='end end kw'>end</span>
2217
+
2218
+ <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>
2219
+
2220
+ <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>
2221
+ <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>
2222
+ <span class='else else kw'>else</span>
2223
+ <span class='comment val'># make the announcement</span>
2224
+ <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>
2225
+ <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>
2226
+
2227
+ <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>
2228
+ <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>
2229
+ <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>
2230
+
2231
+ <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>
2232
+ <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>
2233
+
2234
+ <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>
2235
+ <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>
2236
+ <span class='puts identifier id'>puts</span> <span class='string val'>&quot;Successfully announced to ruby-talk mailing list:&quot;</span>
2237
+ <span class='puts identifier id'>puts</span> <span class='page identifier id'>page</span><span class='dot token'>.</span><span class='uri identifier id'>uri</span>
2238
+ <span class='else else kw'>else</span>
2239
+ <span class='warn identifier id'>warn</span> <span class='string val'>&quot;Could not announce to ruby-talk mailing list:&quot;</span>
2240
+ <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>
2241
+ <span class='end end kw'>end</span>
2242
+ <span class='end end kw'>end</span>
2243
+ <span class='end end kw'>end</span>
2244
+ <span class='end end kw'>end</span>
2245
+
2246
+ <span class='desc identifier id'>desc</span> <span class='string val'>'Announce to RAA (Ruby Application Archive).'</span>
2247
+ <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>
2248
+ <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>
2249
+ <span class='warn identifier id'>warn</span> <span class='dstring node'>&quot;#{message}, so I can NOT announce this release to RAA:&quot;</span>
2250
+ <span class='warn identifier id'>warn</span> <span class='dstring node'>&quot;#{(page/'h2').text} -- #{(page/'p').first.text.strip}&quot;</span>
2251
+ <span class='end end kw'>end</span>
2252
+
2253
+ <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>
2254
+
2255
+ <span class='require identifier id'>require</span> <span class='string val'>'mechanize'</span>
2256
+ <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>
2257
+ <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>
2258
+
2259
+ <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>
2260
+ <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>
2261
+
2262
+ <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>
2263
+ <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>
2264
+ <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>
2265
+ <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>
2266
+ <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>
2267
+ <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>
2268
+ <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>
2269
+
2270
+ <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>
2271
+
2272
+ <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>
2273
+ <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>
2274
+ <span class='else else kw'>else</span>
2275
+ <span class='puts identifier id'>puts</span> <span class='string val'>&quot;Successfully announced to RAA (Ruby Application Archive).&quot;</span>
2276
+ <span class='end end kw'>end</span>
2277
+ <span class='else else kw'>else</span>
2278
+ <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>
2279
+ <span class='end end kw'>end</span>
2280
+ <span class='end end kw'>end</span>
2281
+
2282
+ <span class='comment val'># release packages</span>
2283
+ <span class='desc identifier id'>desc</span> <span class='string val'>'Publish release packages to RubyForge.'</span>
2284
+ <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>
2285
+ <span class='comment val'># check if this release was already published</span>
2286
+ <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>
2287
+ <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>
2288
+
2289
+ <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>
2290
+ <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>
2291
+ <span class='else else kw'>else</span>
2292
+ <span class='comment val'># create the FRS package section</span>
2293
+ <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>
2294
+ <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>
2295
+ <span class='end end kw'>end</span>
2296
+
2297
+ <span class='comment val'># publish the package to the section</span>
2298
+ <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>
2299
+ <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>
2300
+ <span class='end end kw'>end</span>
2301
+
2302
+ <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>
2303
+ <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>
2304
+
2305
+ <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>
2306
+ <span class='comment val'># NOTE: use the 'add_release' command ONLY for the first</span>
2307
+ <span class='comment val'># file because it creates a new sub-section on the</span>
2308
+ <span class='comment val'># RubyForge download page; we do not want one package</span>
2309
+ <span class='comment val'># per sub-section on the RubyForge download page!</span>
2310
+ <span class='comment val'>#</span>
2311
+ <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>
2312
+
2313
+ <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>
2314
+ <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>
2315
+ <span class='end end kw'>end</span>
2316
+
2317
+ <span class='puts identifier id'>puts</span> <span class='string val'>&quot;Successfully published release packages to RubyForge.&quot;</span>
2318
+ <span class='end end kw'>end</span>
2319
+ <span class='end end kw'>end</span>
2320
+ <span class='end end kw'>end</span>
2321
+ <span class='end end kw'>end</span>
2322
+ </pre>
2323
+ </td>
2324
+ </tr>
2325
+ </table>
2326
+ </div>
2327
+ </div>
2328
+ </div>
2329
+ </div>
2330
+
2331
+ </div>
2332
+ </div>
2333
+
2334
+ </div>
2335
+ </div>
2336
+ </body>
2337
+ </html>