File Coverage

inc/Perl/Critic/Module/Build/Standard.pm
Criterion Covered Total %
statement 20 43 46.5
branch 1 6 16.6
condition n/a
subroutine 7 13 53.8
pod 1 6 16.6
total 29 68 42.6


line stmt bran cond sub pod time code
1             package Perl::Critic::Module::Build::Standard;
2              
3 1     1   455 use 5.010001;
  1         3  
4              
5 1     1   4 use strict;
  1         1  
  1         24  
6 1     1   3 use warnings;
  1         0  
  1         54  
7              
8             our $VERSION = '1.126';
9              
10 1     1   4 use Carp;
  1         1  
  1         58  
11 1     1   4 use English qw< $OS_ERROR -no_match_vars >;
  1         1  
  1         4  
12              
13              
14 1     1   83 use parent 'Module::Build';
  1         1  
  1         4  
15              
16              
17             sub ACTION_authortest {
18 0     0 0 0 my ($self) = @_;
19              
20 0         0 $self->authortest_dependencies();
21 0         0 $self->depends_on('test');
22              
23 0         0 return;
24             }
25              
26              
27             sub ACTION_authortestcover {
28 0     0 0 0 my ($self) = @_;
29              
30 0         0 $self->authortest_dependencies();
31 0         0 $self->depends_on('testcover');
32              
33 0         0 return;
34             }
35              
36              
37             sub ACTION_distdir {
38 0     0 0 0 my ($self, @arguments) = @_;
39              
40 0         0 $self->depends_on('authortest');
41              
42 0         0 return $self->SUPER::ACTION_distdir(@arguments);
43             }
44              
45              
46             sub ACTION_manifest {
47 0     0 0 0 my ($self, @arguments) = @_;
48              
49             # Make sure we get rid of files that no longer exist.
50 0 0       0 if (-e 'MANIFEST') {
51 0 0       0 unlink 'MANIFEST' or die "Can't unlink MANIFEST: $OS_ERROR";
52             }
53              
54 0         0 return $self->SUPER::ACTION_manifest(@arguments);
55             }
56              
57              
58             sub tap_harness_args {
59 1     1 0 30403 my ($self) = @_;
60              
61 1 50       7 return $self->_tap_harness_args() if $ENV{RUNNING_UNDER_TEAMCITY};
62 1         2 return;
63             }
64              
65              
66             sub _tap_harness_args {
67 0     0     return {formatter_class => 'TAP::Formatter::TeamCity', merge => 1};
68             }
69              
70              
71             sub authortest_dependencies {
72 0     0 1   my ($self) = @_;
73              
74 0           $self->depends_on('build');
75 0           $self->depends_on('manifest');
76 0           $self->depends_on('distmeta');
77              
78 0           $self->test_files( qw< t xt > );
79 0           $self->recursive_test_files(1);
80              
81 0           return;
82             }
83              
84              
85             1;
86              
87              
88             __END__
89              
90             #-----------------------------------------------------------------------------
91              
92             =pod
93              
94             =for stopwords
95              
96             =head1 NAME
97              
98             Perl::Critic::Module::Build::Standard - Customization of L<Module::Build> for L<Perl::Critic> distributions.
99              
100              
101             =head1 DESCRIPTION
102              
103             This is a custom subclass of L<Module::Build> that enhances existing
104             functionality and adds more for the benefit of installing and
105             developing L<Perl::Critic>. The following actions have been added
106             or redefined:
107              
108              
109             =head1 ACTIONS
110              
111             =over
112              
113             =item authortest
114              
115             Runs the regular tests plus the author tests (those in F<xt>).
116             It used to be the case that author tests were run if an environment
117             variable was set or if a F<.svn> directory existed. What ended up
118             happening was that people that had that environment variable set for
119             other purposes or who had done a checkout of the code repository would
120             run those tests, which would fail, and we'd get bug reports for
121             something not expected to run elsewhere. Now, you've got to
122             explicitly ask for the author tests to be run.
123              
124              
125             =item authortestcover
126              
127             As C<authortest> is to the standard C<test> action, C<authortestcover>
128             is to the standard C<testcover> action.
129              
130              
131             =item distdir
132              
133             In addition to the standard action, this adds a dependency upon the
134             C<authortest> action so you can't do a release without passing the
135             author tests.
136              
137              
138             =back
139              
140              
141             =head1 METHODS
142              
143             In addition to the above actions:
144              
145              
146             =head2 C<authortest_dependencies()>
147              
148             Sets up dependencies upon the C<build>, C<manifest>, and C<distmeta> actions,
149             adds F<xt> to the set of test directories, and turns on the recursive
150             search for tests.
151              
152              
153             =head1 AUTHOR
154              
155             Elliot Shank <perl@galumph.com>
156              
157             =head1 COPYRIGHT
158              
159             Copyright (c) 2007-2011 Elliot Shank.
160              
161             This program is free software; you can redistribute it and/or modify
162             it under the same terms as Perl itself. The full text of this license
163             can be found in the LICENSE file included with this module.
164              
165             =cut
166              
167              
168             ##############################################################################
169             # Local Variables:
170             # mode: cperl
171             # cperl-indent-level: 4
172             # fill-column: 78
173             # indent-tabs-mode: nil
174             # c-indentation-style: bsd
175             # End:
176             # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :