| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::Chimps::Server::Lister; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
31371
|
use warnings; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
80
|
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
124
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
2576
|
use Params::Validate qw<:all>; |
|
|
2
|
|
|
|
|
25655
|
|
|
|
2
|
|
|
|
|
575
|
|
|
7
|
2
|
|
|
2
|
|
558
|
use Test::Chimps::Report; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
20
|
|
|
8
|
2
|
|
|
2
|
|
2061
|
use HTML::Mason; |
|
|
2
|
|
|
|
|
260444
|
|
|
|
2
|
|
|
|
|
30
|
|
|
9
|
2
|
|
|
2
|
|
5086
|
use DateTime; |
|
|
2
|
|
|
|
|
401507
|
|
|
|
2
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Test::Chimps::Server::Lister - Format the list of smoke reports |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
This module encapsulates the formatting and output of the smoke |
|
18
|
|
|
|
|
|
|
report list. You should not have to use this module directly |
|
19
|
|
|
|
|
|
|
unless you need to customize listing output. To do so, subclass |
|
20
|
|
|
|
|
|
|
C and pass one to your C. |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
package MyLister; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use base 'Test::Chimps::Server::Lister'; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub foo { ... } |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
package main; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
use Test::Chimps::Server; |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $lister = MyLister->new(); |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $server = Test::Chimps::Server->new( |
|
35
|
|
|
|
|
|
|
base_dir => '/var/www/smokes', |
|
36
|
|
|
|
|
|
|
lister => $lister |
|
37
|
|
|
|
|
|
|
); |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
$server->handle_request; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 METHODS |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
|
44
|
|
|
|
|
|
|
|
|
45
|
2
|
|
|
2
|
|
147
|
use base qw/Class::Accessor/; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
1728
|
|
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors( |
|
48
|
|
|
|
|
|
|
qw/max_reports_per_subcategory list_template/ |
|
49
|
|
|
|
|
|
|
); |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 new |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Returns a new Lister object |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub new { |
|
59
|
1
|
|
|
1
|
1
|
15
|
my $class = shift; |
|
60
|
1
|
|
|
|
|
3
|
my $obj = bless {}, $class; |
|
61
|
1
|
|
|
|
|
6
|
$obj->_init(@_); |
|
62
|
1
|
|
|
|
|
3
|
return $obj; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub _init { |
|
66
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
|
67
|
1
|
|
|
|
|
49
|
my %args = validate_with( |
|
68
|
|
|
|
|
|
|
params => \@_, |
|
69
|
|
|
|
|
|
|
called => 'The Test::Chimps::Server::Lister constructor', |
|
70
|
|
|
|
|
|
|
spec => { |
|
71
|
|
|
|
|
|
|
list_template => { |
|
72
|
|
|
|
|
|
|
type => SCALAR, |
|
73
|
|
|
|
|
|
|
optional => 0, |
|
74
|
|
|
|
|
|
|
}, |
|
75
|
|
|
|
|
|
|
max_reports_per_subcategory => { |
|
76
|
|
|
|
|
|
|
type => SCALAR, |
|
77
|
|
|
|
|
|
|
optional => 0 |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
); |
|
81
|
|
|
|
|
|
|
|
|
82
|
1
|
|
|
|
|
9
|
foreach my $key (keys %args) { |
|
83
|
2
|
|
|
|
|
18
|
$self->{$key} = $args{$key}; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 output_list |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Output the smoke report listing. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub output_list { |
|
94
|
0
|
|
|
0
|
1
|
|
my ($self, $template_dir, $reports, $cgi) = @_; |
|
95
|
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
my $interp = HTML::Mason::Interp->new(comp_root => $template_dir); |
|
97
|
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
my $categories = $self->_build_heirarchy($reports); |
|
99
|
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
$interp->exec(File::Spec->catfile(File::Spec->rootdir, |
|
101
|
|
|
|
|
|
|
$self->list_template), |
|
102
|
|
|
|
|
|
|
categories => $categories, |
|
103
|
|
|
|
|
|
|
cgi => $cgi); |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub _build_heirarchy { |
|
107
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
108
|
0
|
|
|
|
|
|
my $reports = shift; |
|
109
|
|
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
my $categories = {}; |
|
111
|
0
|
|
|
|
|
|
foreach my $report (@$reports) { |
|
112
|
0
|
|
|
|
|
|
my $category = $self->_compute_category($report); |
|
113
|
0
|
|
|
|
|
|
my $subcategory = $self->_compute_subcategory($report); |
|
114
|
0
|
|
|
|
|
|
push @{$categories->{$category}->{$subcategory}}, $report; |
|
|
0
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
} |
|
116
|
0
|
|
|
|
|
|
$self->_sort_reports($categories); |
|
117
|
0
|
|
|
|
|
|
$self->_prune_reports($categories); |
|
118
|
0
|
|
|
|
|
|
return $categories; |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub _compute_category { |
|
122
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
123
|
0
|
|
|
|
|
|
my $report = shift; |
|
124
|
0
|
|
|
|
|
|
return $report->project; |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub _compute_subcategory { |
|
128
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
129
|
0
|
|
|
|
|
|
my $report = shift; |
|
130
|
0
|
|
|
|
|
|
return ''; |
|
131
|
|
|
|
|
|
|
} |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub _sort_reports { |
|
134
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
135
|
0
|
|
|
|
|
|
my $categories = shift; |
|
136
|
|
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
|
foreach my $category (keys %$categories) { |
|
138
|
0
|
|
|
|
|
|
foreach my $subcategory (keys %{$categories->{$category}}) { |
|
|
0
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
@{$categories->{$category}->{$subcategory}} = |
|
|
0
|
|
|
|
|
|
|
|
140
|
0
|
|
|
|
|
|
sort _by_revision_then_date @{$categories->{$category}->{$subcategory}}; |
|
141
|
|
|
|
|
|
|
} |
|
142
|
|
|
|
|
|
|
} |
|
143
|
|
|
|
|
|
|
} |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub _by_revision_then_date { |
|
146
|
0
|
|
|
0
|
|
|
my $res = $b->revision <=> $a->revision; |
|
147
|
|
|
|
|
|
|
|
|
148
|
0
|
0
|
|
|
|
|
if ($res != 0) { |
|
149
|
0
|
|
|
|
|
|
return $res; |
|
150
|
|
|
|
|
|
|
} |
|
151
|
|
|
|
|
|
|
|
|
152
|
0
|
|
|
|
|
|
return DateTime->compare($b->timestamp, $a->timestamp); |
|
153
|
|
|
|
|
|
|
} |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub _prune_reports { |
|
156
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
157
|
0
|
|
|
|
|
|
my $categories = shift; |
|
158
|
|
|
|
|
|
|
|
|
159
|
0
|
|
|
|
|
|
foreach my $category (keys %$categories) { |
|
160
|
0
|
|
|
|
|
|
foreach my $subcategory (keys %{$categories->{$category}}) { |
|
|
0
|
|
|
|
|
|
|
|
161
|
0
|
0
|
|
|
|
|
if (scalar @{$categories->{$category}->{$subcategory}} > |
|
|
0
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
$self->max_reports_per_subcategory) |
|
163
|
|
|
|
|
|
|
{ |
|
164
|
0
|
|
|
|
|
|
@{$categories->{$category}->{$subcategory}} = |
|
|
0
|
|
|
|
|
|
|
|
165
|
0
|
|
|
|
|
|
@{$categories->{$category}->{$subcategory}}[0 .. ($self->max_reports_per_subcategory - 1)]; |
|
166
|
|
|
|
|
|
|
} |
|
167
|
|
|
|
|
|
|
} |
|
168
|
|
|
|
|
|
|
} |
|
169
|
|
|
|
|
|
|
} |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 AUTHOR |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Zev Benjamin, C<< >> |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 BUGS |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
|
178
|
|
|
|
|
|
|
C, or through the web interface at |
|
179
|
|
|
|
|
|
|
L. |
|
180
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
|
181
|
|
|
|
|
|
|
your bug as I make changes. |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head1 SUPPORT |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
perldoc Test::Chimps |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
You can also look for information at: |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=over 4 |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=item * Mailing list |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Chimps has a mailman mailing list at |
|
196
|
|
|
|
|
|
|
L. You can subscribe via the web |
|
197
|
|
|
|
|
|
|
interface at |
|
198
|
|
|
|
|
|
|
L. |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
L |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
L |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
L |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=item * Search CPAN |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
L |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=back |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
Copyright 2006 Best Practical Solutions. |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
223
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=cut |
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
1; |