File Coverage

blib/lib/Dist/Zilla/PluginBundle/Author/KENTNL/Lite.pm
Criterion Covered Total %
statement 23 56 41.0
branch 0 18 0.0
condition 0 5 0.0
subroutine 8 12 66.6
pod 1 3 33.3
total 32 94 34.0


line stmt bran cond sub pod time code
1 1     1   533 use 5.006; # our
  1         2  
2 1     1   5 use strict;
  1         1  
  1         21  
3 1     1   11 use warnings;
  1         1  
  1         86  
4              
5             package Dist::Zilla::PluginBundle::Author::KENTNL::Lite;
6              
7             our $VERSION = '2.001001';
8              
9             # ABSTRACT: (DEPRECATED) A Minimal Build-Only replacement for @Author::KENTNL for contributors.
10              
11             our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
12              
13 1     1   448 use Moose qw( with );
  1         293142  
  1         6  
14 1     1   3951 use Module::Runtime qw( );
  1         2  
  1         24  
15 1     1   4 use Try::Tiny qw( try );
  1         2  
  1         81  
16              
17             with 'Dist::Zilla::Role::PluginBundle';
18              
19 1     1   627 use namespace::autoclean -also => [qw( _expand _maybe )];
  1         6110  
  1         6  
20              
21             sub _expand {
22             my ( undef, $suffix, $conf ) = @_;
23             ## no critic ( RequireInterpolationOfMetachars )
24             if ( ref $suffix ) {
25             my ( $corename, $rename ) = @{$suffix};
26             if ( exists $conf->{-name} ) {
27             $rename = delete $conf->{-name};
28             }
29             return [ q{@Author::KENTNL::Lite/} . $corename . q{/} . $rename, 'Dist::Zilla::Plugin::' . $corename, $conf ];
30             }
31             if ( exists $conf->{-name} ) {
32             my $rename;
33             $rename = sprintf q{%s/%s}, $suffix, ( delete $conf->{-name} );
34             return [ q{@Author::KENTNL::Lite/} . $rename, 'Dist::Zilla::Plugin::' . $suffix, $conf ];
35              
36             }
37              
38             return [ q{@Author::KENTNL::Lite/} . $suffix, 'Dist::Zilla::Plugin::' . $suffix, $conf ];
39             }
40              
41              
42              
43              
44              
45              
46              
47             sub _maybe {
48             my ( $module, @passthrough ) = @_;
49             my $modname = Module::Runtime::compose_module_name( 'Dist::Zilla::Plugin', $module );
50             if ( try { Module::Runtime::require_module($modname); 1 } ) {
51             return @passthrough;
52             }
53             require Carp;
54             Carp::carp( q{[} . q[@] . q{Author::KENTNL::Lite] Skipping _maybe dep } . $module );
55             return ();
56             }
57              
58              
59              
60              
61              
62              
63              
64              
65              
66              
67 0     0 0   sub mvp_multivalue_args { return qw( auto_prereqs_skip ) }
68              
69             sub _only_fiveten {
70 0     0     my ( $arg, @payload ) = @_;
71 0 0         return () if exists $ENV{'KENTNL_NOFIVETEN'};
72 0 0         return @payload unless defined $arg;
73 0 0         return @payload unless 'HASH' eq ref $arg;
74 0 0         return @payload unless exists $arg->{'no_fiveten'};
75 0           return ();
76             }
77              
78             sub bundle_config_inner {
79 0     0 0   my ( undef, $arg ) = @_;
80 0 0         if ( not exists $arg->{git_versions} ) {
81 0           require Carp;
82 0           Carp::croak('Sorry, Git based versions are now mandatory');
83             }
84 0 0         if ( not defined $arg->{authority} ) {
85 0           $arg->{authority} = 'cpan:KENTNL';
86             }
87 0 0         if ( not defined $arg->{auto_prereqs_skip} ) {
88 0           $arg->{auto_prereqs_skip} = [];
89             }
90 0 0         if ( not 'ARRAY' eq ref $arg->{auto_prereqs_skip} ) {
91 0           require Carp;
92 0           Carp::carp('[Author::KENTNL::Lite] auto_prereqs_skip is expected to be an array ref');
93             }
94              
95 0           my (@version) = (
96             [
97             'Git::NextVersion' => {
98             version_regexp => '^(.*)-source$',
99             first_version => '0.1.0',
100             },
101             ],
102             );
103              
104             ## no critic (ProhibitPunctuationVars)
105 0 0         my (@metadata) = (
106             [ 'MetaConfig' => {} ],
107             _maybe( 'GithubMeta', [ 'GithubMeta' => {} ] ),
108             _maybe( 'MetaProvides::Package', [ 'MetaProvides::Package' => {} ] ),
109             _maybe(
110             'MetaData::BuiltWith',
111             [
112             'MetaData::BuiltWith' =>
113             { 'linux' eq $^O ? ( show_uname => 1, uname_args => q{ -s -o -r -m -i } ) : (), show_config => 1 },
114             ],
115             ),
116             );
117              
118 0           my (@sharedir) = ();
119              
120 0           my (@gatherfiles) = (
121             [ 'GatherDir' => { include_dotfiles => 1 } ],
122             [ 'License' => {} ],
123             [ 'MetaJSON' => {} ],
124             [ 'MetaYAML' => {} ],
125             [ 'Manifest' => {} ],
126             [ 'MetaTests' => {} ],
127             [ 'PodCoverageTests' => {} ],
128             [ 'PodSyntaxTests' => {} ],
129             _maybe( 'ReportVersions::Tiny', [ 'ReportVersions::Tiny' => {} ], ),
130             _maybe( 'Test::Kwalitee', [ 'Test::Kwalitee' => {} ] ),
131             [ 'EOLTests' => { trailing_whitespace => 1, } ],
132             _maybe( 'Test::MinimumVersion', [ 'Test::MinimumVersion' => {} ], ),
133             [ 'Test::Compile' => {} ],
134             _maybe( 'Test::Perl::Critic', [ 'Test::Perl::Critic' => {} ] ),
135              
136             );
137              
138 0           my (@prunefiles) = ( [ 'PruneCruft' => { except => '^.perltidyrc' } ], [ 'ManifestSkip' => {} ], );
139              
140             my (@regprereqs) = (
141 0   0       [ 'AutoPrereqs' => { skip => $arg->{auto_prereqs_skip} } ],
142             [
143             'Prereqs' => {
144             -name => 'BundleDevelNeeds',
145             -phase => 'develop',
146             -type => 'requires',
147             'Dist::Zilla::PluginBundle::Author::KENTNL::Lite' => 0,
148             },
149             ],
150             [
151             'Prereqs' => {
152             -name => 'BundleDevelRecommends',
153             -phase => 'develop',
154             -type => 'recommends',
155             'Dist::Zilla::PluginBundle::Author::KENTNL::Lite' => __PACKAGE__->VERSION || '1.3.0',
156             },
157             ],
158             [
159             'Prereqs' => {
160             -name => 'BundleDevelSuggests',
161             -phase => 'develop',
162             -type => 'suggests',
163             'Dist::Zilla::PluginBundle::Author::KENTNL' => '1.2.0',
164             },
165             ],
166             _maybe( 'Author::KENTNL::MinimumPerl', [ 'Author::KENTNL::MinimumPerl' => { _only_fiveten( $arg, fiveten => 1 ) } ] ),
167             _maybe( 'Author::KENTNL::Prereqs::Latest::Selective', [ 'Author::KENTNL::Prereqs::Latest::Selective' => {} ] ),
168             );
169              
170 0           my (@mungers) = (
171             [ 'PkgVersion' => {} ],
172             [ 'PodWeaver' => {} ],
173             [ 'NextRelease' => { time_zone => 'UTC', format => q[%v %{yyyy-MM-dd'T'HH:mm:ss}dZ] } ],
174              
175             );
176              
177             return (
178             @version,
179             @metadata,
180             @sharedir,
181             @gatherfiles,
182             @prunefiles,
183             @mungers,
184             @regprereqs,
185 0           _maybe( 'Authority', [ 'Authority' => { authority => $arg->{authority}, do_metadata => 1 } ] ),
186             [ 'ModuleBuild' => {} ],
187             _maybe( 'ReadmeFromPod', [ 'ReadmeFromPod' => {} ], ),
188             _maybe(
189             'ReadmeAnyFromPod',
190             [
191             'ReadmeAnyFromPod' => {
192             type => 'markdown',
193             filename => 'README.mkdn',
194             location => 'root',
195             },
196             ],
197             ),
198             _maybe( 'Test::CPAN::Changes', [ 'Test::CPAN::Changes' => {} ] ),
199             _maybe( 'CheckExtraTests' => [ 'CheckExtraTests' => {} ], ),
200             [ 'TestRelease' => {} ],
201             [ 'FakeRelease' => {} ],
202             );
203             }
204              
205             sub bundle_config {
206 0     0 1   my ( $self, $section ) = @_;
207 0   0       my $class = ( ref $self ) || $self;
208              
209             # NO RELEASING. KTHX.
210             ## no critic ( Variables::RequireLocalizedPunctuationVars )
211 0           $ENV{DZIL_FAKERELEASE_FAIL} = 1;
212              
213 0           my $arg = $section->{payload};
214              
215 0           my @config = map { _expand( $class, $_->[0], $_->[1] ) } $class->bundle_config_inner($arg);
  0            
216              
217 0           return @config;
218             }
219             __PACKAGE__->meta->make_immutable;
220 1     1   771 no Moose;
  1         1  
  1         7  
221              
222             ## no critic (RequireEndWithOne)
223             'Thankyou for flying with KENTNL Lite!';
224              
225             __END__
226              
227             =pod
228              
229             =encoding UTF-8
230              
231             =head1 NAME
232              
233             Dist::Zilla::PluginBundle::Author::KENTNL::Lite - (DEPRECATED) A Minimal Build-Only replacement for @Author::KENTNL for contributors.
234              
235             =head1 VERSION
236              
237             version 2.001001
238              
239             =head1 SYNOPSIS
240              
241             -[@Author::KENTNL]
242             +[@Author::KENTNL::Lite]
243              
244             dzil build
245             dzil test
246             dzil release # BANG.
247              
248             =head1 DEPRECATED
249              
250             I'm no longer really keeping this up-to-date with my main bundle, and I've migrated to some other strategy.
251              
252             Any of my distributions that ship a <dist.ini.meta> are now flattened out into C<dist.ini> so that no bundles are
253             implicated, and you can simply delete plugins that are inconveniencing you.
254              
255             =head1 NAMING SCHEME
256              
257             Please read my rant in L<Dist::Zilla::PluginBundle::Author::KENTNL/NAMING SCHEME> about the Author:: convention.
258              
259             =head1 DESCRIPTION
260              
261             This is an attempt at one way of solving a common problem when contributing to things built with
262             L<< C<Dist::Zilla>|Dist::Zilla >>.
263              
264             This is done by assuming that the code base that its targeting will B<NEVER> be released in its built form,
265             but close enough to the normal build method that it's suitable for testing and contributing.
266              
267             =over 4
268              
269             =item * Less install time dependencies
270              
271             =item * More phases in the C<PluginBundle> generation are 'optional'
272              
273             =item * Less points of failure
274              
275             =back
276              
277             Good examples of things I've experienced in this category are the 2 following ( But awesome ) plug-ins that I use everywhere.
278              
279             =head2 L<< The C<::Git> Plug-ins|Dist::Zilla::Plugin::Git >>
280              
281             These plug-ins are great, don't get me wrong, but they pose a barrier for people on Win32, and in fact, anyone without a copy of
282             Git installed, ( Its hard enough getting a copy of the pre-release source without Git, but that's available in C<tar.gz> and
283             C<.zip> on C<github> ).
284              
285             Working Copies of Git plug-ins are also nonessential if you're not building releases.
286              
287             =head2 L<< The C<::Twitter> Plug-in|Dist::Zilla::Plugin::Twitter >>
288              
289             Also, a handy plug-in to have, but you're not going to be needing it unless you're tweeting a release, and usually,
290             that means you're me.
291              
292             Some of its dependencies have been known to fail tests on Windows platforms, and thus block automatic installation, so seeing
293             you don't have any use for this, its sensible to leave it out.
294              
295             =head1 METHODS
296              
297             =head2 bundle_config
298              
299             See L<< the C<PluginBundle> role|Dist::Zilla::Role::PluginBundle >> for what this is for, it is a method to satisfy that role.
300              
301             =for Pod::Coverage mvp_multivalue_args
302             bundle_config_inner
303              
304             =head1 AUTHOR
305              
306             Kent Fredric <kentnl@cpan.org>
307              
308             =head1 COPYRIGHT AND LICENSE
309              
310             This software is copyright (c) 2017 by Kent Fredric <kentnl@cpan.org>.
311              
312             This is free software; you can redistribute it and/or modify it under
313             the same terms as the Perl 5 programming language system itself.
314              
315             =cut