line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::Prove::Controller; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
5
|
8
|
|
|
8
|
|
106518
|
use Mojo::Base 'Mojolicious::Controller'; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
49
|
|
6
|
|
|
|
|
|
|
|
7
|
8
|
|
|
8
|
|
5528
|
use App::Prove; |
|
8
|
|
|
|
|
150230
|
|
|
8
|
|
|
|
|
291
|
|
8
|
8
|
|
|
8
|
|
3999
|
use Capture::Tiny qw(capture); |
|
8
|
|
|
|
|
29153
|
|
|
8
|
|
|
|
|
483
|
|
9
|
8
|
|
|
8
|
|
55
|
use File::Basename; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
481
|
|
10
|
8
|
|
|
8
|
|
3810
|
use File::Find::Rule; |
|
8
|
|
|
|
|
58551
|
|
|
8
|
|
|
|
|
65
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = 0.10; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub list { |
15
|
7
|
|
|
7
|
1
|
41622
|
my $self = shift; |
16
|
|
|
|
|
|
|
|
17
|
7
|
|
|
|
|
50
|
my $conf = $self->stash->{conf}; |
18
|
|
|
|
|
|
|
|
19
|
7
|
|
|
|
|
68
|
my $name = $self->param( 'name' ); |
20
|
7
|
100
|
100
|
|
|
1165
|
if ( $name && !exists $conf->{$name} ) { |
21
|
2
|
|
|
|
|
6
|
$self->render( 'prove_exception' ); |
22
|
2
|
|
|
|
|
1934
|
return; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
5
|
100
|
|
|
|
14
|
if ( $name ) { |
26
|
1
|
|
|
|
|
31
|
my @files = File::Find::Rule->file->name( '*.t' )->maxdepth( 1 )->in( $conf->{$name} ); |
27
|
1
|
|
|
|
|
893
|
$self->stash( files => [ map{ basename $_ }@files ] ); |
|
2
|
|
|
|
|
59
|
|
28
|
1
|
|
|
|
|
19
|
$self->stash( names => '' ); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
else { |
31
|
4
|
|
|
|
|
16
|
$self->stash( name => '' ); |
32
|
4
|
|
|
|
|
69
|
$self->stash( names => [ keys %{$conf} ] ); |
|
4
|
|
|
|
|
31
|
|
33
|
4
|
|
|
|
|
54
|
$self->stash( files => '' ); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
5
|
|
|
|
|
79
|
$self->render( 'prove_file_list' ); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub file { |
40
|
5
|
|
|
5
|
1
|
68622
|
my $self = shift; |
41
|
|
|
|
|
|
|
|
42
|
5
|
|
|
|
|
27
|
my $file = $self->param( 'file' ); |
43
|
5
|
|
|
|
|
160
|
my $name = $self->param( 'name' ); |
44
|
|
|
|
|
|
|
|
45
|
5
|
|
|
|
|
84
|
$self->stash( format => 'html' ); |
46
|
|
|
|
|
|
|
|
47
|
5
|
|
|
|
|
97
|
my $conf = $self->stash->{conf}; |
48
|
|
|
|
|
|
|
|
49
|
5
|
100
|
|
|
|
45
|
if ( !exists $conf->{$name} ) { |
50
|
1
|
|
|
|
|
14
|
$self->render( 'prove_exception' ); |
51
|
1
|
|
|
|
|
1717
|
return; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
4
|
|
|
|
|
127
|
my @files = File::Find::Rule->file->name( '*.t' )->maxdepth( 1 )->in( $conf->{$name} ); |
55
|
|
|
|
|
|
|
|
56
|
4
|
|
|
|
|
3532
|
my ($found) = grep{ $file eq basename $_ }@files; |
|
8
|
|
|
|
|
228
|
|
57
|
|
|
|
|
|
|
|
58
|
4
|
100
|
|
|
|
21
|
if ( !$found ) { |
59
|
2
|
|
|
|
|
16
|
$self->render( 'prove_exception' ); |
60
|
2
|
|
|
|
|
1196
|
return; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
2
|
|
|
|
|
4
|
my $content = do{ local ( @ARGV,$/ ) = $found; <> }; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
109
|
|
64
|
2
|
|
|
|
|
10
|
$self->stash( code => $content ); |
65
|
2
|
|
|
|
|
64
|
$self->stash( file => $file ); |
66
|
|
|
|
|
|
|
|
67
|
2
|
|
|
|
|
30
|
$self->render( 'prove_file' ); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub run { |
71
|
8
|
|
|
8
|
1
|
91741
|
my $self = shift; |
72
|
|
|
|
|
|
|
|
73
|
8
|
|
|
|
|
51
|
my $file = $self->param( 'file' ); |
74
|
8
|
|
|
|
|
1597
|
my $name = $self->param( 'name' ); |
75
|
|
|
|
|
|
|
|
76
|
8
|
|
|
|
|
159
|
my $conf = $self->stash->{conf}; |
77
|
|
|
|
|
|
|
|
78
|
8
|
100
|
|
|
|
110
|
if ( !exists $conf->{$name} ) { |
79
|
2
|
|
|
|
|
15
|
$self->render( 'prove_exception' ); |
80
|
2
|
|
|
|
|
7902
|
return; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
6
|
|
|
|
|
183
|
my @files = File::Find::Rule->file->name( '*.t' )->maxdepth( 1 )->in( $conf->{$name} ); |
84
|
|
|
|
|
|
|
|
85
|
6
|
|
|
|
|
5939
|
my $found; |
86
|
6
|
100
|
|
|
|
26
|
if ( $file ) { |
87
|
3
|
|
|
|
|
9
|
($found) = grep{ $file eq basename $_ }@files; |
|
6
|
|
|
|
|
224
|
|
88
|
|
|
|
|
|
|
|
89
|
3
|
100
|
|
|
|
11
|
if ( !$found ) { |
90
|
1
|
|
|
|
|
5
|
$self->render( 'prove_exception' ); |
91
|
1
|
|
|
|
|
539
|
return; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
5
|
100
|
|
|
|
21
|
my @args = $found ? $found : @files; |
96
|
5
|
|
|
|
|
22
|
@args = sort @args; |
97
|
|
|
|
|
|
|
|
98
|
5
|
|
|
|
|
20
|
local $ENV{HARNESS_TIMER}; |
99
|
|
|
|
|
|
|
|
100
|
5
|
|
100
|
|
|
32
|
my $accepts = $self->app->renderer->accepts( $self )->[0] // 'html'; |
101
|
5
|
100
|
|
|
|
2474
|
my $format = $accepts =~ m{\Ahtml?} ? 'html' : $accepts; |
102
|
|
|
|
|
|
|
|
103
|
5
|
|
|
|
|
62
|
my $prove = App::Prove->new; |
104
|
|
|
|
|
|
|
|
105
|
5
|
|
|
|
|
504
|
$prove->process_args( '--norc', @args ); |
106
|
5
|
100
|
|
|
|
15051
|
$prove->formatter('TAP::Formatter::HTML') if $format eq 'html'; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
my ($stdout, $stderr, @result) = capture { |
109
|
5
|
|
|
5
|
|
6433
|
$prove->run; |
110
|
5
|
|
|
|
|
176
|
}; |
111
|
|
|
|
|
|
|
|
112
|
5
|
100
|
|
|
|
4125354
|
if ( $format eq 'html' ) { |
113
|
1
|
|
|
|
|
33
|
$stdout =~ s{\A.*?^(<!DOCTYPE)}{$1}xms; |
114
|
1
|
|
|
|
|
41
|
$self->render( text => $stdout ); |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
else { |
117
|
4
|
|
|
|
|
106
|
$self->tx->res->headers->content_type('text/plain'); |
118
|
4
|
|
|
|
|
981
|
$self->render( text => $stdout ); |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
1; |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
__END__ |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=pod |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=encoding UTF-8 |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 NAME |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Mojolicious::Plugin::Prove::Controller - Controller for Mojolicious::Plugin::Prove |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 VERSION |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
version 0.1 |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 METHODS |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head2 file |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head2 list |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head2 run |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 AUTHOR |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Renee Baecker <reneeb@cpan.org> |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
This software is Copyright (c) 2015 by Renee Baecker. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
This is free software, licensed under: |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=cut |
159
|
|
|
|
|
|
|
|