/[suikacvs]/webroot/commitfeed/mkcommitfeed.pl
Suika

Diff of /webroot/commitfeed/mkcommitfeed.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by wakaba, Mon Nov 24 05:21:35 2008 UTC revision 1.5 by wakaba, Mon Nov 24 06:34:49 2008 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl  #!/usr/bin/perl
2  use strict;  use strict;
3    
 use Data::Dumper;  
 print Dumper \@ARGV;  
   
4  use Getopt::Long;  use Getopt::Long;
5  use Pod::Usage;  use Pod::Usage;
6  use Time::Local;  use Time::Local;
# Line 151  my $content = $entry->content_element; Line 148  my $content = $entry->content_element;
148  $content->type ('text');  $content->type ('text');
149  $content->text_content ($entry_content);  $content->text_content ($entry_content);
150    
151    my $feed_date = $entry_date;
152    my $feed_updated = $feed->updated_element;
153    my $feed_updated_value = $feed_updated->value;
154    if ($feed_updated_value < $feed_date) {
155      $feed_updated->value ($feed_date);
156    }
157    
158    
159  {  {
160    open my $file, '>:utf8', $file_name or die "$0: $file_name: $!";    open my $file, '>:utf8', $file_name or die "$0: $file_name: $!";
161    print $file $doc->inner_html;    print $file $doc->inner_html;
162  }  }
163    
164  ## $Date$  ## $Date$
165    
166    __END__
167    
168    =head1 NAME
169    
170    mkcommitfeed.pl - Commit Log Feed Generator
171    
172    =head1 SYNOPSIS
173    
174      mkcommitfeed.pl \
175        --file-name filename.atom \
176        --feed-url http://example.com/myproject/filename.atom \
177        --feed-title "MyProject Commit Log" \
178        --feed-lang langtag \
179        --feed-related-url "http://example.com/myproject/" \
180        --feed-license-url "http://example.com/myproject/license" \
181        --feed-rights "Copyright or copyleft statement" \
182        < changes-in-this-revision.txt
183    
184    =head1 DESCRIPTION
185    
186    The C<mkcommitfeed.pl> script provides a command-line interface to
187    update an Atom Feed that is intended for providing commit logs for a
188    software developmenet project.
189    
190    The script, when invoked, adds an Atom Entry that describes a change
191    made to the project's repository.
192    
193    =head1 STANDARD INPUT
194    
195    A description for the change must be specified to the standard input.
196    It is used as the plain text content of the atom:content element of
197    the Entry for the change to add.
198    
199    Non-ASCII characters are not supported in this version of this script.
200    Maybe a future version of this script would support UTF-8.
201    
202    =head1 ARGUMENTS
203    
204    There are command-line options for the script.  Some of them are
205    required, while the others are optional.  As a general rule, an option
206    whose name begins with C<--entry> specifies a property for the Entry
207    to add, while an option whose name begins with C<--feed> specifies a
208    property for the entire Feed.  Option values for Feed properties might
209    not be used when updating an existing Feed document.
210    
211    =over 4
212    
213    =item C<--entry-author-mail I<[email protected]>> (optional)
214    
215    Specifies the mail address of the person who made a change.  It is
216    used as the content of the C<atom:email> element of the C<atom:author>
217    element of the Entry.
218    
219    If this option is not specified, but the standard input includes a
220    ChangeLog entry in the standard GNU format, then the mail address is
221    taken from the ChangeLog entry.  Otherwise, C<atom:email> element is
222    not specified.
223    
224    The option value must be an RFC 2822 C<addr-spec> that does not match
225    C<obs-addr-spec> (i.e. standard email address format).  Otherwise the
226    generated Feed would be non-conforming.
227    
228    =item C<--entry-author-name I<author-name>> (conditionally required)
229    
230    Specifies the human readable name of the person who made a change.  It
231    is used as the content of the C<atom:name> element of the
232    C<atom:author> element of the Entry.
233    
234    If this option is not specified, but the standard input includes a
235    ChangeLog entry in the standard GNU format, then the name is taken
236    from the ChangeLog entry.  If the standard input does not include a
237    GNU format ChangeLog entry, then the C<--entry-author-name> option
238    must be specified.
239    
240    Non-ASCII characters are not supported in this version of this script.
241    
242    =item C<--entry-content I<description>> (optional)
243    
244    Specifies the description of the change.  It is used as the content of
245    the C<atom:content> element of the Entry, with C<type=text>.
246    
247    If this option is specified, its value is used as if it were from the
248    standard input and the actual standard input, if any, is ignored.  If
249    neither this option nor the standard input is specified, then the
250    description is assumed as the empty string.
251    
252    Non-ASCII characters are not supported in this version of this script.
253    
254    =item C<--entry-title I<title>> (optional)
255    
256    Specifies the title of the change.  It is used as the content of the
257    C<atom:title> element of the Entry, with C<type=text>.
258    
259    If this option is not specified, then the date of the change, as well
260    as the name of the author, is used as title.
261    
262    Non-ASCII characters are not supported in this version of this script.
263    
264    =item C<--feed-author-mail I<[email protected]>> (optional)
265    
266    Specifies the mail address of the author of the Feed.  It is used as
267    the content of the C<atom:email> element of the C<atom:author> element
268    of the Feed.
269    
270    This option is ignored if the C<--feed-author-name> option is not
271    specified.
272    
273    If this option is not specified, C<atom:email> element is not
274    specified.
275    
276    The option value must be an RFC 2822 C<addr-spec> that does not match
277    C<obs-addr-spec> (i.e. standard email address format).  Otherwise the
278    generated Feed would be non-conforming.
279    
280    This option is ignored if the Feed already has an C<atom:author>
281    element.
282    
283    =item C<--feed-author-name I<author-name>> (optional)
284    
285    Specifies the human readable name of the author of the Feed.  It is
286    used as the content of the C<atom:name> element of the C<atom:author>
287    element of the Feed.
288    
289    If this option is not specified, the C<atom:author> element is not
290    specified in the Feed.
291    
292    Non-ASCII characters are not supported in this version of this script.
293    
294    This option is ignored if the Feed already has an C<atom:author>
295    element.
296    
297    =item C<--feed-author-url I<url>> (optional)
298    
299    Specifies the URI for the author (e.g. URL of the Web page for the
300    author).  It is used as the content of the C<atom:uri> element of the
301    C<atom:author> element of the Feed.
302    
303    If the C<--feed-author-name> option is not specified, this option is
304    ignored.
305    
306    If this option is not specified, the C<atom:uri> element is not
307    specified.
308    
309    The option value must be a URI reference conforming to RFC 3986.  It
310    should be an absolute reference unless you understand what is the base
311    URL that is used to resolve a relative reference.  Non-ASCII
312    characters (i.e. IRI references) are not supported in this version of
313    this script.
314    
315    This option is ignored if the Feed already has an C<atom:author>
316    element.
317    
318    =item C<--feed-lang I<langtag>> (optional)
319    
320    Specifies the natural language used in textual parts of the Feed.  It
321    is used as the value of C<xml:lang> attribute of the root element of
322    the Feed.
323    
324    If this option is not specified, the default value I<i-default> is used.
325    
326    This option is ignored if the Feed already exists and has a
327    C<atom:link> element.
328    
329    =item C<--feed-license-url I<url>> (optional)
330    
331    Specifies the URL that describes the license of the Feed.  It is used
332    as the C<href> attribute value of an C<atom:link> element whose C<rel>
333    is C<license>.
334    
335    If this option is not specified, the C<atom:link> element whose C<rel>
336    is C<license> is not specified.
337    
338    The option value must be a URI reference conforming to RFC 3986.  It
339    should be an absolute reference unless you understand what is the base
340    URL that is used to resolve a relative reference.  Non-ASCII
341    characters (i.e. IRI references) are not supported in this version of
342    this script.
343    
344    This option is ignored if the Feed already has a C<atom:link>
345    element.
346    
347    =item C<--feed-related-url I<url>> (optional)
348    
349    Specifies a related URL for the Feed.  Usually the URL for the project
350    Web page should be specified.  It is used as the C<href> attribute
351    value of an C<atom:link> element whose C<rel> is C<related>.
352    
353    If this option is not specified, the C<atom:link> element whose C<rel>
354    is C<related> is not specified.
355    
356    The option value must be a URI reference conforming to RFC 3986.  It
357    should be an absolute reference unless you understand what is the base
358    URL that is used to resolve a relative reference.  Non-ASCII
359    characters (i.e. IRI references) are not supported in this version of
360    this script.
361    
362    This option is ignored if the Feed already has a C<atom:link>
363    element.
364    
365    =item C<--feed-rights C<license-terms>> (optional)
366    
367    Specifies the license terms for the Feed.  It is used as the content
368    of the C<atom:rights> element of the Feed.
369    
370    If there is the C<atom:rights> element exists, its value is replaced
371    by the value of this option.
372    
373    If this option is not specified, the C<atom:rights> element is not
374    added.  If there are already the C<atom:rights> element specified,
375    however, it is not removed from the Feed.
376    
377    Non-ASCII characters are not supported in this version of this script.
378    
379    =item C<--feed-title C<title>> (optional)
380    
381    Specifies the title of the Feed.  It is used as the content of the
382    C<atom:title> of the Feed.
383    
384    If this option is not specified, the default value "ChangeLog" is used.
385    
386    If there is Feed exists, then this option is ignored.
387    
388    Non-ASCII characters are not supported in this version of this script.
389    
390    =item C<--feed-url C<url>> (required)
391    
392    Specifies the URL of the Feed itself.  It is used in various places,
393    such as in the C<href> attribute of the C<atom:link> element whose
394    C<rel> is C<self>.
395    
396    The option value must be a URI reference conforming to RFC 3986.  It
397    should be an absolute reference unless you understand what is the base
398    URL that is used to resolve a relative reference.  Non-ASCII
399    characters (i.e. IRI references) are not supported in this version of
400    this script.
401    
402    =item C<--file-name C<path-to-atom-file>> (required)
403    
404    Specifies the path to the file that contains the Atom Feed.
405    
406    If the specified file is not found, then a new file is created.
407    Otherwise, the existing file is loaded as an Atom Feed and then it is
408    updated.
409    
410    The file, if exists, must be encoded in UTF-8.  The new content of the
411    file generated by this script is encoded in UTF-8.
412    
413    =item C<--help>
414    
415    Shows a help message and aborts.
416    
417    =back
418    
419    =head1 DEPENDENCY
420    
421    For the execution of C<mkcommitfeed.pl>, the libiraries below are
422    required, as well as Perl 5.10.0 or later:
423    
424    manakai-core L<http://suika.fam.cx/www/manakai-core/doc/web/>
425    
426    Whatpm L<http://suika.fam.cx/www/markup/html/whatpm/readme>
427    
428    =head1 DOWNLOAD
429    
430    The latest version of this script is available from the CVS
431    repository: L<http://suika.fam.cx/gate/cvs/webroot/commitfeed/>.
432    
433    A gzipped tarball for the files is also available:
434    L<http://suika.fam.cx/gate/cvs/webroot/commitfeed/commitfeed.tar.gz?tarball=1>.
435    
436    =head1 SEE ALSO
437    
438    The C<mkcommitfeed.pl> Web site
439    L<http://suika.fam.cx/commitfeed/readme>.
440    
441    =head1 AUTHOR
442    
443    Wakaba <[email protected]>.
444    
445    =head1 HISTORY
446    
447    This module was originally developed as part of Whatpm
448    L<http://suika.fam.cx/www/markup/html/whatpm/readme>.
449    
450    An Atom Feed for updates for this script, which is itself generated by
451    this script, is available at
452    L<http://suika.fam.cx/commitfeed/commitfeed-commit>.
453    
454    =head1 LICENSE
455    
456    Copyright 2008 Wakaba <[email protected]>
457    
458    This program is free software; you can redistribute it and/or
459    modify it under the same terms as Perl itself.
460    
461    =cut
462    
463    ## $Date$

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.5

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24