line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::Prove::Controller; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
101113
|
use Mojo::Base 'Mojolicious::Controller'; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
51
|
|
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
5483
|
use App::Prove; |
|
7
|
|
|
|
|
145140
|
|
|
7
|
|
|
|
|
274
|
|
6
|
7
|
|
|
7
|
|
3640
|
use Capture::Tiny qw(capture); |
|
7
|
|
|
|
|
30008
|
|
|
7
|
|
|
|
|
462
|
|
7
|
7
|
|
|
7
|
|
115
|
use File::Basename; |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
515
|
|
8
|
7
|
|
|
7
|
|
3730
|
use File::Find::Rule; |
|
7
|
|
|
|
|
60542
|
|
|
7
|
|
|
|
|
62
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = 0.09; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub list { |
13
|
7
|
|
|
7
|
1
|
49533
|
my $self = shift; |
14
|
|
|
|
|
|
|
|
15
|
7
|
|
|
|
|
33
|
my $conf = $self->stash->{conf}; |
16
|
|
|
|
|
|
|
|
17
|
7
|
|
|
|
|
82
|
my $name = $self->param( 'name' ); |
18
|
7
|
100
|
100
|
|
|
1437
|
if ( $name && !exists $conf->{$name} ) { |
19
|
2
|
|
|
|
|
10
|
$self->render( 'prove_exception' ); |
20
|
2
|
|
|
|
|
2309
|
return; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
5
|
100
|
|
|
|
20
|
if ( $name ) { |
24
|
1
|
|
|
|
|
37
|
my @files = File::Find::Rule->file->name( '*.t' )->maxdepth( 1 )->in( $conf->{$name} ); |
25
|
1
|
|
|
|
|
1087
|
$self->stash( files => [ map{ basename $_ }@files ] ); |
|
2
|
|
|
|
|
82
|
|
26
|
1
|
|
|
|
|
25
|
$self->stash( names => '' ); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
else { |
29
|
4
|
|
|
|
|
19
|
$self->stash( name => '' ); |
30
|
4
|
|
|
|
|
89
|
$self->stash( names => [ keys %{$conf} ] ); |
|
4
|
|
|
|
|
24
|
|
31
|
4
|
|
|
|
|
69
|
$self->stash( files => '' ); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
5
|
|
|
|
|
97
|
$self->render( 'prove_file_list' ); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub file { |
38
|
5
|
|
|
5
|
1
|
74081
|
my $self = shift; |
39
|
|
|
|
|
|
|
|
40
|
5
|
|
|
|
|
28
|
my $file = $self->param( 'file' ); |
41
|
5
|
|
|
|
|
123
|
my $name = $self->param( 'name' ); |
42
|
|
|
|
|
|
|
|
43
|
5
|
|
|
|
|
106
|
$self->stash( format => 'html' ); |
44
|
|
|
|
|
|
|
|
45
|
5
|
|
|
|
|
89
|
my $conf = $self->stash->{conf}; |
46
|
|
|
|
|
|
|
|
47
|
5
|
100
|
|
|
|
49
|
if ( !exists $conf->{$name} ) { |
48
|
1
|
|
|
|
|
5
|
$self->render( 'prove_exception' ); |
49
|
1
|
|
|
|
|
1843
|
return; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
4
|
|
|
|
|
122
|
my @files = File::Find::Rule->file->name( '*.t' )->maxdepth( 1 )->in( $conf->{$name} ); |
53
|
|
|
|
|
|
|
|
54
|
4
|
|
|
|
|
3818
|
my ($found) = grep{ $file eq basename $_ }@files; |
|
8
|
|
|
|
|
224
|
|
55
|
|
|
|
|
|
|
|
56
|
4
|
100
|
|
|
|
26
|
if ( !$found ) { |
57
|
2
|
|
|
|
|
17
|
$self->render( 'prove_exception' ); |
58
|
2
|
|
|
|
|
1017
|
return; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
2
|
|
|
|
|
4
|
my $content = do{ local ( @ARGV,$/ ) = $found; <> }; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
138
|
|
62
|
2
|
|
|
|
|
14
|
$self->stash( code => $content ); |
63
|
2
|
|
|
|
|
43
|
$self->stash( file => $file ); |
64
|
|
|
|
|
|
|
|
65
|
2
|
|
|
|
|
35
|
$self->render( 'prove_file' ); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub run { |
69
|
7
|
|
|
7
|
1
|
66398
|
my $self = shift; |
70
|
|
|
|
|
|
|
|
71
|
7
|
|
|
|
|
55
|
my $file = $self->param( 'file' ); |
72
|
7
|
|
|
|
|
1186
|
my $name = $self->param( 'name' ); |
73
|
|
|
|
|
|
|
|
74
|
7
|
|
|
|
|
172
|
my $conf = $self->stash->{conf}; |
75
|
|
|
|
|
|
|
|
76
|
7
|
100
|
|
|
|
80
|
if ( !exists $conf->{$name} ) { |
77
|
2
|
|
|
|
|
13
|
$self->render( 'prove_exception' ); |
78
|
2
|
|
|
|
|
7909
|
return; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
5
|
|
|
|
|
176
|
my @files = File::Find::Rule->file->name( '*.t' )->maxdepth( 1 )->in( $conf->{$name} ); |
82
|
|
|
|
|
|
|
|
83
|
5
|
|
|
|
|
6164
|
my $found; |
84
|
5
|
100
|
|
|
|
30
|
if ( $file ) { |
85
|
3
|
|
|
|
|
10
|
($found) = grep{ $file eq basename $_ }@files; |
|
6
|
|
|
|
|
287
|
|
86
|
|
|
|
|
|
|
|
87
|
3
|
100
|
|
|
|
12
|
if ( !$found ) { |
88
|
1
|
|
|
|
|
6
|
$self->render( 'prove_exception' ); |
89
|
1
|
|
|
|
|
528
|
return; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
4
|
100
|
|
|
|
18
|
my @args = $found ? $found : @files; |
94
|
4
|
|
|
|
|
19
|
@args = sort @args; |
95
|
|
|
|
|
|
|
|
96
|
4
|
|
|
|
|
19
|
local $ENV{HARNESS_TIMER}; |
97
|
|
|
|
|
|
|
|
98
|
4
|
|
|
|
|
48
|
my $prove = App::Prove->new; |
99
|
4
|
|
|
|
|
478
|
$prove->process_args( '--norc', @args ); |
100
|
|
|
|
|
|
|
my ($stdout, $stderr, @result) = capture { |
101
|
4
|
|
|
4
|
|
6161
|
$prove->run; |
102
|
4
|
|
|
|
|
11709
|
}; |
103
|
|
|
|
|
|
|
|
104
|
4
|
|
|
|
|
2951460
|
$self->render( text => $stdout ); |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
1; |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
__END__ |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=pod |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=encoding UTF-8 |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 NAME |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Mojolicious::Plugin::Prove::Controller |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 VERSION |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
version 0.09 |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 METHODS |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head2 file |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 list |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head2 run |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 AUTHOR |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Renee Baecker <reneeb@cpan.org> |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This software is Copyright (c) 2015 by Renee Baecker. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
This is free software, licensed under: |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |
144
|
|
|
|
|
|
|
|