blib/lib/SVN/Web/RSS.pm

filter: Statementstmt 100% 9 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 12 / 12 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/SVN/Web/Log.pm ↑ Summary blib/lib/SVN/Web/Revision.pm »
1 package SVN::Web::RSS;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use base 'SVN::Web::Log';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 our $VERSION = 0.54;
8  
9 =head1 NAME
10  
11 SVN::Web::RSS - SVN::Web action to generate an RSS feed
12  
13 =head1 SYNOPSIS
14  
15 In F<config.yaml>
16  
17 actions:
18 ...
19 rss:
20 class: SVN::Web::RSS
21 action_menu:
22 show:
23 - file
24 - directory
25 link_text: (rss)
26 head_only: 1
27 icon: /css/trac/feed-icon-16x16.png
28 opts:
29 publisher: address@domain
30 ...
31  
32 =head1 DESCRIPTION
33  
34 Generates an RSS feed of commits to a file or path in the Subversion
35 repository.
36  
37 =head1 CONFIGURATION
38  
39 The following options may be specified in F<config.yaml>.
40  
41 =over
42  
43 =item publisher
44  
45 The e-mail address of the feed's publisher. This is placed in to the
46 C<< <dc:publisher> >> element in the RSS output.
47  
48 There is no default. If not specified then no C<< <dc:publisher> >>
49 element is included.
50  
51 =back
52  
53 B<Note:> RSS dates have a specific format. Accordingly, the C<timezone>
54 and C<timedate_format> configuration options are ignored by this action.
55  
56 =head1 OPTIONS
57  
58 See L<SVN::Web::Log>.
59  
60 =head1 TEMPLATE VARIABLES
61  
62 See L<SVN::Web::Log>.
63  
64 =head1 EXCEPTIONS
65  
66 See L<SVN::Web::Log>.
67  
68 =cut
69  
70 my %default_opts = ( publisher => '' );
71  
72 # <dc:date> elements have a specific format that we must use, overriding
73 # the user's choice
74 sub format_svn_timestamp {
75 my $self = shift;
76 my $cstring = shift;
77  
78 my $time = SVN::Core::time_from_cstring($cstring) / 1_000_000;
79  
80 return POSIX::strftime( '%Y-%m-%dT%H:%M:%S', gmtime($time) );
81 }
82  
83 sub run {
84 my $self = shift;
85  
86 my $data = $self->SUPER::run(@_)->{data};
87  
88 $self->{opts} = { %default_opts, %{ $self->{opts} } };
89  
90 return {
91 template => 'rss',
92 mimetype => 'text/xml',
93 data => { %{$data}, publisher => $self->{opts}{publisher}, }
94 };
95 }
96  
97 1;
98  
99 =head1 COPYRIGHT
100  
101 Copyright 2003-2004 by Chia-liang Kao C<< <clkao@clkao.org> >>.
102  
103 Copyright 2005-2007 by Nik Clayton C<< <nik@FreeBSD.org> >>.
104  
105 Copyright 2012 by Dean Hamstead C<< <dean@fragfest.com.au> >>.
106  
107 This program is free software; you can redistribute it and/or modify it
108 under the same terms as Perl itself.
109  
110 See L<http://www.perl.com/perl/misc/Artistic.html>
111  
112 =cut
« blib/lib/SVN/Web/Log.pm ↑ Summary blib/lib/SVN/Web/Revision.pm »