File Coverage

blib/lib/Dist/Zilla/Plugin/NoSmartCommentsTests.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 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.007-7-g03732ff
13             $Dist::Zilla::Plugin::NoSmartCommentsTests::VERSION = '0.008'; # TRIAL
14              
15             # ABSTRACT: Make sure no Smart::Comments escape into the wild
16              
17 1     1   20273 use Moose;
  1         461963  
  1         6  
18 1     1   7162 use namespace::autoclean;
  1         7678  
  1         4  
19 1     1   1010 use MooseX::AttributeShortcuts;
  1         354568  
  1         6  
20              
21 1     1   33878 use autobox::Core;
  1         17833  
  1         8  
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             ;
31              
32             around merged_section_data => sub {
33             my ($orig, $self) = (shift, shift);
34              
35             ### invoke the original to get the sections...
36             my $data = $self->$orig(@_);
37              
38             ### bail if no data...
39             return unless $data;
40              
41             ### munge each section with our template engine...
42             my %stash = ( files => [ map { $_->name } $self->found_files->flatten ] );
43             do { $data->{$_} = \( $self->fill_in_string(${$data->{$_}}, { %stash }) ) }
44             for $data->keys;
45              
46             ### $data
47             return $data;
48             };
49              
50             __PACKAGE__->meta->make_immutable;
51             !!42;
52              
53             =pod
54              
55             =encoding UTF-8
56              
57             =for :stopwords Chris Weyl
58              
59             =for :stopwords Wishlist flattr flattr'ed gittip gittip'ed
60              
61             =head1 NAME
62              
63             Dist::Zilla::Plugin::NoSmartCommentsTests - Make sure no Smart::Comments escape into the wild
64              
65             =head1 VERSION
66              
67             This document describes version 0.008 of Dist::Zilla::Plugin::NoSmartCommentsTests - released August 07, 2015 as part of Dist-Zilla-Plugin-NoSmartCommentsTests.
68              
69             =head1 SYNOPSIS
70              
71             ; In C<dist.ini>:
72             [Test::NoSmartComments]
73              
74             =head1 DESCRIPTION
75              
76             This is an extension of L<Dist::Zilla::Plugin::InlineFiles>, providing the
77             following file:
78              
79             xt/release/no-smart-comments.t - test to ensure no Smart::Comments
80              
81             =head1 NOTE
82              
83             The name of this plugin has turned out to be somewhat misleading, I'm afraid:
84             we don't actually test for the _existance_ of smart comments, rather we
85             ensure that Smart::Comment is not used by any file checked.
86              
87             =head1 BUGS
88              
89             All complex software has bugs lurking in it, and this module is no exception.
90              
91             Please report any bugs to
92             "bug-dist-zilla-plugin-nosmartcommentstests@rt.cpan.org", or through the web
93             interface at <http://rt.cpan.org>.
94              
95             Patches and pull requests through GitHub are most welcome; our page and repo
96             (same URI):
97              
98             https://github.com/RsrchBoy/dist-zilla-plugin-nosmartcommentstests
99              
100             =head1 SEE ALSO
101              
102             Please see those modules/websites for more information related to this module.
103              
104             =over 4
105              
106             =item *
107              
108             L<Smart::Comments|Smart::Comments>
109              
110             =item *
111              
112             L<Test::NoSmartComments|Test::NoSmartComments>
113              
114             =back
115              
116             =head1 BUGS
117              
118             Please report any bugs or feature requests on the bugtracker website
119             https://github.com/RsrchBoy/dist-zilla-plugin-nosmartcommentstests/issues
120              
121             When submitting a bug or request, please include a test-file or a
122             patch to an existing test-file that illustrates the bug or desired
123             feature.
124              
125             =head1 AUTHOR
126              
127             Chris Weyl <cweyl@alumni.drew.edu>
128              
129             =head2 I'm a material boy in a material world
130              
131             =begin html
132              
133             <a href="https://gratipay.com/RsrchBoy/"><img src="http://img.shields.io/gratipay/RsrchBoy.svg" /></a>
134             <a href="http://bit.ly/rsrchboys-wishlist"><img src="http://wps.io/wp-content/uploads/2014/05/amazon_wishlist.resized.png" /></a>
135             <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>
136              
137             =end html
138              
139             Please note B<I do not expect to be gittip'ed or flattr'ed for this work>,
140             rather B<it is simply a very pleasant surprise>. I largely create and release
141             works like this because I need them or I find it enjoyable; however, don't let
142             that stop you if you feel like it ;)
143              
144             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>,
145             L<Gratipay|https://gratipay.com/RsrchBoy/>, or indulge my
146             L<Amazon Wishlist|http://bit.ly/rsrchboys-wishlist>... If and *only* if you so desire.
147              
148             =head1 COPYRIGHT AND LICENSE
149              
150             This software is Copyright (c) 2011 by Chris Weyl.
151              
152             This is free software, licensed under:
153              
154             The GNU Lesser General Public License, Version 2.1, February 1999
155              
156             =cut
157              
158             __DATA__
159             ___[ xt/release/no-smart-comments.t ]___
160             #!/usr/bin/env perl
161              
162             use strict;
163             use warnings;
164              
165             use Test::More 0.88;
166              
167             eval "use Test::NoSmartComments";
168             plan skip_all => 'Test::NoSmartComments required for checking comment IQ'
169             if $@;
170              
171             {{ foreach my $file (@files) { $OUT .= qq{no_smart_comments_in("$file");\n} } }}
172             done_testing();