| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::Test::CheckDeps; |
|
2
|
|
|
|
|
|
|
{ |
|
3
|
|
|
|
|
|
|
$Dist::Zilla::Plugin::Test::CheckDeps::VERSION = '0.012'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
|
|
|
|
|
|
# git description: v0.011-5-g6f4c027 |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
BEGIN { |
|
8
|
3
|
|
|
3
|
|
3179027
|
$Dist::Zilla::Plugin::Test::CheckDeps::AUTHORITY = 'cpan:ETHER'; |
|
9
|
|
|
|
|
|
|
} |
|
10
|
|
|
|
|
|
|
# vim: set ts=4 sw=4 tw=78 et nolist : |
|
11
|
|
|
|
|
|
|
|
|
12
|
3
|
|
|
3
|
|
23
|
use Moose; |
|
|
3
|
|
|
|
|
3
|
|
|
|
3
|
|
|
|
|
23
|
|
|
13
|
|
|
|
|
|
|
extends qw/Dist::Zilla::Plugin::InlineFiles/; |
|
14
|
|
|
|
|
|
|
with qw/Dist::Zilla::Role::TextTemplate Dist::Zilla::Role::PrereqSource/; |
|
15
|
3
|
|
|
3
|
|
12521
|
use namespace::autoclean; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
25
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has todo_when => ( |
|
18
|
|
|
|
|
|
|
is => 'ro', |
|
19
|
|
|
|
|
|
|
isa => 'Str', |
|
20
|
|
|
|
|
|
|
default => '0', # special value for 'insert no special code at all' |
|
21
|
|
|
|
|
|
|
); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has fatal => ( |
|
24
|
|
|
|
|
|
|
is => 'ro', |
|
25
|
|
|
|
|
|
|
isa => 'Bool', |
|
26
|
|
|
|
|
|
|
default => 0, |
|
27
|
|
|
|
|
|
|
); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has level => ( |
|
30
|
|
|
|
|
|
|
is => 'ro', |
|
31
|
|
|
|
|
|
|
isa => 'Str', |
|
32
|
|
|
|
|
|
|
lazy => 1, |
|
33
|
|
|
|
|
|
|
default => 'classic', |
|
34
|
|
|
|
|
|
|
); |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has filename => ( |
|
37
|
|
|
|
|
|
|
is => 'ro', |
|
38
|
|
|
|
|
|
|
isa => 'Str', |
|
39
|
|
|
|
|
|
|
default => 't/00-check-deps.t', |
|
40
|
|
|
|
|
|
|
); |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
around add_file => sub { |
|
43
|
|
|
|
|
|
|
my ($orig, $self, $file) = @_; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
return $self->$orig( |
|
46
|
|
|
|
|
|
|
Dist::Zilla::File::InMemory->new( |
|
47
|
|
|
|
|
|
|
name => $self->filename, |
|
48
|
|
|
|
|
|
|
content => $self->fill_in_string($file->content, |
|
49
|
|
|
|
|
|
|
{ |
|
50
|
|
|
|
|
|
|
dist => \($self->zilla), |
|
51
|
|
|
|
|
|
|
plugin => \$self, |
|
52
|
|
|
|
|
|
|
todo_when => $self->todo_when, |
|
53
|
|
|
|
|
|
|
fatal => $self->fatal, |
|
54
|
|
|
|
|
|
|
level => $self->level, |
|
55
|
|
|
|
|
|
|
}) |
|
56
|
|
|
|
|
|
|
) |
|
57
|
|
|
|
|
|
|
); |
|
58
|
|
|
|
|
|
|
}; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub register_prereqs { |
|
61
|
3
|
|
|
3
|
0
|
10275
|
my $self = shift; |
|
62
|
3
|
|
|
|
|
77
|
$self->zilla->register_prereqs({ phase => 'test' }, 'Test::More' => '0.94', 'Test::CheckDeps' => '0.010'); |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# ABSTRACT: Check for presence of dependencies |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=pod |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=encoding UTF-8 |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=for :stopwords Leon Timmermans Brendan Byrd Karen Etheridge TODO |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 NAME |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Test::CheckDeps - Check for presence of dependencies |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 VERSION |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
version 0.012 |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
[Test::CheckDeps] |
|
86
|
|
|
|
|
|
|
fatal = 0 ; default |
|
87
|
|
|
|
|
|
|
level = classic |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This module adds a test that assures all dependencies have been installed properly. If requested, it can bail out all testing on error. |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
This plugin accepts the following options: |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=over 4 |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item * C<todo_when>: a code string snippet (evaluated when the test is run) |
|
98
|
|
|
|
|
|
|
to indicate when failing tests should be considered L<TODO|Test::More/Conditional tests>, |
|
99
|
|
|
|
|
|
|
rather than genuine fails -- default is '0' (tests are never C<TODO>). |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Other suggested values are: |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
todo_when = !$ENV{AUTHOR_TESTING} && !$ENV{AUTOMATED_TESTING} |
|
104
|
|
|
|
|
|
|
todo_when = $^V < '5.012' ; CPAN.pm didn't reliably read META.* before this |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=item * C<fatal>: if true, C<BAIL_OUT> is called if the tests fail. Defaults |
|
107
|
|
|
|
|
|
|
to false. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item * C<level>: passed to C<check_dependencies> in L<Test::CheckDeps>. |
|
110
|
|
|
|
|
|
|
(Defaults to C<classic>.) |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * C<filename>: the name of the generated file. Defaults to |
|
113
|
|
|
|
|
|
|
F<t/00-check-deps.t>. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=back |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=for Pod::Coverage register_prereqs |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 AUTHOR |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Leon Timmermans <leont@cpan.org> |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This software is copyright (c) 2011 by Leon Timmermans. |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
128
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=over 4 |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=item * |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Brendan Byrd <GitHub@ResonatorSoft.org> |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=item * |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Karen Etheridge <ether@cpan.org> |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=item * |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Leon Timmermans <fawaka@gmail.com> |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=back |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=cut |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
__DATA__ |
|
151
|
|
|
|
|
|
|
___[ test-checkdeps ]___ |
|
152
|
|
|
|
|
|
|
use strict; |
|
153
|
|
|
|
|
|
|
use warnings; |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
# this test was generated with {{ ref($plugin) . ' ' . ($plugin->VERSION || '<self>') }} |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
use Test::More 0.94; |
|
158
|
|
|
|
|
|
|
{{ |
|
159
|
|
|
|
|
|
|
my $use = 'use Test::CheckDeps 0.010;'; |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
# todo_when = 0 is treated as a special default, backwards-compatible case |
|
162
|
|
|
|
|
|
|
$use = "BEGIN {\n ($todo_when) && eval \"" . $use |
|
163
|
|
|
|
|
|
|
. " 1\"\n or plan skip_all => '!!! Test::CheckDeps required for checking dependencies -- failure to satisfy specified prerequisites!';\n}\n" |
|
164
|
|
|
|
|
|
|
. $use |
|
165
|
|
|
|
|
|
|
if $todo_when ne '0'; |
|
166
|
|
|
|
|
|
|
$use |
|
167
|
|
|
|
|
|
|
}} |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
{{ |
|
170
|
|
|
|
|
|
|
$todo_when eq '0' |
|
171
|
|
|
|
|
|
|
? '' |
|
172
|
|
|
|
|
|
|
: "local \$TODO = 'these tests are not fatal when $todo_when' if (${todo_when});\n" |
|
173
|
|
|
|
|
|
|
. 'my $builder = Test::Builder->new;' . "\n" |
|
174
|
|
|
|
|
|
|
. 'my $todo_output_orig = $builder->todo_output;' . "\n" |
|
175
|
|
|
|
|
|
|
. '$builder->todo_output($builder->failure_output);' . "\n"; |
|
176
|
|
|
|
|
|
|
}} |
|
177
|
|
|
|
|
|
|
check_dependencies('{{ $level }}'); |
|
178
|
|
|
|
|
|
|
{{ |
|
179
|
|
|
|
|
|
|
$todo_when ne '0' ? "\$builder->todo_output(\$todo_output_orig);\n" : ''; |
|
180
|
|
|
|
|
|
|
}} |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
if ({{ $fatal }}) { |
|
183
|
|
|
|
|
|
|
BAIL_OUT("Missing dependencies") if !Test::More->builder->is_passing; |
|
184
|
|
|
|
|
|
|
} |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
done_testing; |