File Coverage

blib/lib/Dist/Zilla/Plugin/NoSmartCommentsTests.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 21 21 100.0


line stmt bran cond sub pod time code
1             #
2             # This file is part of Dist-Zilla-Plugin-NoSmartCommentsTests
3             #
4             # This software is Copyright (c) 2011 by Chris Weyl.
5             #
6             # This is free software, licensed under:
7             #
8             # The GNU Lesser General Public License, Version 2.1, February 1999
9             #
10             package Dist::Zilla::Plugin::NoSmartCommentsTests;
11             our $AUTHORITY = 'cpan:RSRCHBOY';
12             # git description: 0.008-9-g4f29d74
13             $Dist::Zilla::Plugin::NoSmartCommentsTests::VERSION = '0.009';
14              
15             # ABSTRACT: Make sure no Smart::Comments escape into the wild
16              
17 3     3   47342 use Moose;
  3         290022  
  3         14  
18 3     3   12373 use namespace::autoclean;
  3         5327  
  3         14  
19 3     3   1605 use MooseX::AttributeShortcuts;
  3         478254  
  3         11  
20              
21 3     3   72956 use autobox::Core;
  3         40480  
  3         18  
22              
23             extends 'Dist::Zilla::Plugin::InlineFiles';
24              
25             with
26             'Dist::Zilla::Role::FileFinderUser' => {
27             default_finders => [qw { :InstallModules :ExecFiles :TestFiles }],
28             },
29             'Dist::Zilla::Role::TextTemplate',
30             'Dist::Zilla::Role::PrereqSource',
31             ;
32              
33              
34             sub register_prereqs {
35 2     2 1 4012 my $self = shift @_;
36              
37 2         55 $self->zilla->register_prereqs(
38             { phase => 'develop' },
39             'Test::NoSmartComments' => 0,
40             );
41              
42 2         797 return;
43             }
44              
45             around merged_section_data => sub {
46             my ($orig, $self) = (shift, shift);
47              
48             ### invoke the original to get the sections...
49             my $data = $self->$orig(@_);
50              
51             ### bail if no data...
52             return unless $data;
53              
54             ### munge each section with our template engine...
55             my %stash = ( files => [ map { $_->name } $self->found_files->flatten ] );
56             do { $data->{$_} = \( $self->fill_in_string(${$data->{$_}}, { %stash }) ) }
57             for $data->keys;
58              
59             ### $data
60             return $data;
61             };
62              
63             __PACKAGE__->meta->make_immutable;
64             !!42;
65              
66             =pod
67              
68             =encoding UTF-8
69              
70             =for :stopwords Chris Weyl
71              
72             =for :stopwords Wishlist flattr flattr'ed gittip gittip'ed
73              
74             =head1 NAME
75              
76             Dist::Zilla::Plugin::NoSmartCommentsTests - Make sure no Smart::Comments escape into the wild
77              
78             =head1 VERSION
79              
80             This document describes version 0.009 of Dist::Zilla::Plugin::NoSmartCommentsTests - released October 09, 2016 as part of Dist-Zilla-Plugin-NoSmartCommentsTests.
81              
82             =head1 SYNOPSIS
83              
84             ; In C<dist.ini>:
85             [Test::NoSmartComments]
86              
87             =head1 DESCRIPTION
88              
89             This is an extension of L<Dist::Zilla::Plugin::InlineFiles>, providing the
90             following file:
91              
92             xt/release/no-smart-comments.t - test to ensure no Smart::Comments
93              
94             =head1 METHODS
95              
96             =head2 register_prereqs
97              
98             Registers a 'develop' phase requirement for L<Test::NoSmartComments> with the
99             L<Dist::Zilla> object.
100              
101             =head1 NOTE
102              
103             The name of this plugin has turned out to be somewhat misleading, I'm afraid:
104             we don't actually test for the _existance_ of smart comments, rather we
105             ensure that Smart::Comment is not used by any file checked.
106              
107             =head1 SEE ALSO
108              
109             Please see those modules/websites for more information related to this module.
110              
111             =over 4
112              
113             =item *
114              
115             L<Smart::Comments|Smart::Comments>
116              
117             =item *
118              
119             L<Test::NoSmartComments|Test::NoSmartComments>
120              
121             =back
122              
123             =head1 BUGS
124              
125             Please report any bugs or feature requests on the bugtracker website
126             L<https://github.com/RsrchBoy/dist-zilla-plugin-nosmartcommentstests/issues>
127              
128             When submitting a bug or request, please include a test-file or a
129             patch to an existing test-file that illustrates the bug or desired
130             feature.
131              
132             =head1 AUTHOR
133              
134             Chris Weyl <cweyl@alumni.drew.edu>
135              
136             =head2 I'm a material boy in a material world
137              
138             =begin html
139              
140             <a href="https://gratipay.com/RsrchBoy/"><img src="http://img.shields.io/gratipay/RsrchBoy.svg" /></a>
141             <a href="http://bit.ly/rsrchboys-wishlist"><img src="http://wps.io/wp-content/uploads/2014/05/amazon_wishlist.resized.png" /></a>
142             <a href="https://flattr.com/submit/auto?user_id=RsrchBoy&url=https%3A%2F%2Fgithub.com%2FRsrchBoy%2Fdist-zilla-plugin-nosmartcommentstests&title=RsrchBoy's%20CPAN%20Dist-Zilla-Plugin-NoSmartCommentsTests&tags=%22RsrchBoy's%20Dist-Zilla-Plugin-NoSmartCommentsTests%20in%20the%20CPAN%22"><img src="http://api.flattr.com/button/flattr-badge-large.png" /></a>
143              
144             =end html
145              
146             Please note B<I do not expect to be gittip'ed or flattr'ed for this work>,
147             rather B<it is simply a very pleasant surprise>. I largely create and release
148             works like this because I need them or I find it enjoyable; however, don't let
149             that stop you if you feel like it ;)
150              
151             L<Flattr|https://flattr.com/submit/auto?user_id=RsrchBoy&url=https%3A%2F%2Fgithub.com%2FRsrchBoy%2Fdist-zilla-plugin-nosmartcommentstests&title=RsrchBoy's%20CPAN%20Dist-Zilla-Plugin-NoSmartCommentsTests&tags=%22RsrchBoy's%20Dist-Zilla-Plugin-NoSmartCommentsTests%20in%20the%20CPAN%22>,
152             L<Gratipay|https://gratipay.com/RsrchBoy/>, or indulge my
153             L<Amazon Wishlist|http://bit.ly/rsrchboys-wishlist>... If and *only* if you so desire.
154              
155             =head1 COPYRIGHT AND LICENSE
156              
157             This software is Copyright (c) 2011 by Chris Weyl.
158              
159             This is free software, licensed under:
160              
161             The GNU Lesser General Public License, Version 2.1, February 1999
162              
163             =cut
164              
165             __DATA__
166             ___[ xt/release/no-smart-comments.t ]___
167             #!/usr/bin/env perl
168              
169             use strict;
170             use warnings;
171              
172             use Test::More 0.88;
173              
174             eval "use Test::NoSmartComments";
175             plan skip_all => 'Test::NoSmartComments required for checking comment IQ'
176             if $@;
177              
178             {{ foreach my $file (@files) { $OUT .= qq{no_smart_comments_in("$file");\n} } }}
179             done_testing();