File Coverage

blib/lib/Dist/Zilla/PluginBundle/Starter.pm
Criterion Covered Total %
statement 49 49 100.0
branch 16 22 72.7
condition 2 3 66.6
subroutine 10 10 100.0
pod 0 8 0.0
total 77 92 83.7


line stmt bran cond sub pod time code
1             package Dist::Zilla::PluginBundle::Starter;
2              
3 9     9   25939915 use Moose;
  9         21  
  9         68  
4             with 'Dist::Zilla::Role::PluginBundle::Easy',
5             'Dist::Zilla::Role::PluginBundle::Config::Slicer',
6             'Dist::Zilla::Role::PluginBundle::PluginRemover';
7 9     9   55669 use namespace::clean;
  9         24  
  9         90  
8              
9             our $VERSION = 'v5.0.0';
10              
11             # Revisions can include entries with the standard plugin name, array ref of plugin/name/config,
12             # or coderefs which are passed the pluginbundle object and return a list of plugins in one of these formats.
13             my %revisions = (
14             1 => [
15             'GatherDir',
16             'MetaYAML',
17             'MetaJSON',
18             'License',
19             'ReadmeAnyFromPod',
20             'PodSyntaxTests',
21             'Test::ReportPrereqs',
22             ['Test::Compile' => { xt_mode => 1 }],
23             'MakeMaker',
24             'Manifest',
25             'PruneCruft',
26             'ManifestSkip',
27             'RunExtraTests',
28             'TestRelease',
29             'ConfirmRelease',
30             sub { $_[0]->pluginset_releaser },
31             'MetaConfig',
32             ['MetaNoIndex' => { directory => [qw(t xt inc share eg examples)] }],
33             'MetaProvides::Package',
34             'ShareDir',
35             'ExecDir',
36             ],
37             2 => [
38             'GatherDir',
39             'MetaYAML',
40             'MetaJSON',
41             'License',
42             'Pod2Readme',
43             'PodSyntaxTests',
44             'Test::ReportPrereqs',
45             ['Test::Compile' => { xt_mode => 1 }],
46             sub { $_[0]->pluginset_installer },
47             'Manifest',
48             'PruneCruft',
49             'ManifestSkip',
50             'RunExtraTests',
51             'TestRelease',
52             'ConfirmRelease',
53             sub { $_[0]->pluginset_releaser },
54             'MetaConfig',
55             ['MetaNoIndex' => { directory => [qw(t xt inc share eg examples)] }],
56             ['MetaProvides::Package' => { inherit_version => 0 }],
57             'ShareDir',
58             sub { $_[0]->pluginset_execdir },
59             ],
60             3 => [
61             sub { $_[0]->pluginset_gatherer },
62             'MetaYAML',
63             'MetaJSON',
64             'License',
65             'Pod2Readme',
66             'PodSyntaxTests',
67             'Test::ReportPrereqs',
68             ['Test::Compile' => { xt_mode => 1 }],
69             sub { $_[0]->pluginset_installer },
70             'Manifest',
71             'PruneCruft',
72             'ManifestSkip',
73             'RunExtraTests',
74             sub { $_[0]->pluginset_release_management }, # before test/confirm for before-release verification
75             'TestRelease',
76             'ConfirmRelease',
77             sub { $_[0]->pluginset_releaser },
78             'MetaConfig',
79             ['MetaNoIndex' => { directory => [qw(t xt inc share eg examples)] }],
80             sub { $_[0]->pluginset_metaprovides },
81             'ShareDir',
82             sub { $_[0]->pluginset_execdir },
83             ],
84             4 => [
85             sub { $_[0]->pluginset_gatherer },
86             'MetaYAML',
87             'MetaJSON',
88             'License',
89             'Pod2Readme',
90             'PodSyntaxTests',
91             'Test::ReportPrereqs',
92             ['Test::Compile' => { xt_mode => 1 }],
93             sub { $_[0]->pluginset_installer },
94             'Manifest',
95             'PruneCruft',
96             'ManifestSkip',
97             'RunExtraTests',
98             sub { $_[0]->pluginset_release_management }, # before test/confirm for before-release verification
99             'TestRelease',
100             'ConfirmRelease',
101             sub { $_[0]->pluginset_releaser },
102             ['MetaNoIndex' => { directory => [qw(t xt inc share eg examples)] }],
103             sub { $_[0]->pluginset_metaprovides },
104             'ShareDir',
105             sub { $_[0]->pluginset_execdir },
106             ],
107             5 => [
108             sub { $_[0]->pluginset_gatherer },
109             'MetaYAML',
110             'MetaJSON',
111             'License',
112             'Pod2Readme',
113             'PodSyntaxTests',
114             'Test::ReportPrereqs',
115             ['Test::Compile' => { xt_mode => 1 }],
116             sub { $_[0]->pluginset_installer },
117             'Manifest',
118             'PruneCruft',
119             ['PruneFiles' => { filename => ['README.pod'] }],
120             'ManifestSkip',
121             'RunExtraTests',
122             sub { $_[0]->pluginset_release_management }, # before test/confirm for before-release verification
123             'TestRelease',
124             'ConfirmRelease',
125             sub { $_[0]->pluginset_releaser },
126             ['MetaNoIndex' => { directory => [qw(t xt inc share eg examples)] }],
127             sub { $_[0]->pluginset_metaprovides },
128             'ShareDir',
129             sub { $_[0]->pluginset_execdir },
130             ],
131             );
132              
133             my %allowed_installers = (
134             MakeMaker => 1,
135             'MakeMaker::Awesome' => 1,
136             ModuleBuild => 1,
137             ModuleBuildTiny => 1,
138             'ModuleBuildTiny::Fallback' => 1,
139             );
140              
141             my %option_requires = (
142             installer => 2,
143             managed_versions => 3,
144             regenerate => 3,
145             );
146              
147             has revision => (
148             is => 'ro',
149             lazy => 1,
150             default => sub { $_[0]->payload->{revision} // 1 },
151             );
152              
153             has installer => (
154             is => 'ro',
155             lazy => 1,
156             default => sub { $_[0]->payload->{installer} // 'MakeMaker' },
157             );
158              
159             has managed_versions => (
160             is => 'ro',
161             lazy => 1,
162             default => sub { $_[0]->payload->{managed_versions} // 0 },
163             );
164              
165             has regenerate => (
166             is => 'ro',
167             lazy => 1,
168             default => sub { $_[0]->payload->{regenerate} // [] },
169             );
170              
171             sub mvp_multivalue_args { qw(regenerate) }
172              
173             sub configure {
174 9     9 0 53 my $self = shift;
175 9         252 my $name = $self->name;
176 9         329 my $revision = $self->revision;
177             die "Unknown [$name] revision specified: $revision\n"
178 9 50       44 unless exists $revisions{$revision};
179 9         20 my @plugins = @{$revisions{$revision}};
  9         65  
180            
181 9         46 foreach my $option (keys %option_requires) {
182 27         195 my $required = $option_requires{$option};
183             die "Option $option requires revision $required\n"
184 27 50 66     682 if exists $self->payload->{$option} and $required > $revision;
185             }
186            
187 9         86 foreach my $plugin (@plugins) {
188 192 100       16857 if (ref $plugin eq 'CODE') {
189 37         98 $self->add_plugins($plugin->($self));
190             } else {
191 155         337 $self->add_plugins($plugin);
192             }
193             }
194             }
195              
196 4     4 0 29 sub gather_plugin { 'GatherDir' }
197              
198             sub pluginset_gatherer {
199 4     4 0 11 my ($self) = @_;
200 4         10 my @copy = @{$self->regenerate};
  4         156  
201 4 50       14 return [$self->gather_plugin => { exclude_filename => [@copy] }] if @copy;
202 4         15 return $self->gather_plugin;
203             }
204              
205             sub pluginset_installer {
206 8     8 0 28 my ($self) = @_;
207 8         303 my $installer = $self->installer;
208             die "Unsupported installer $installer\n"
209 8 50       39 unless $allowed_installers{$installer};
210 8         38 return "$installer";
211             }
212              
213             sub pluginset_release_management {
214 4     4 0 10 my ($self) = @_;
215 4         151 my $versions = $self->managed_versions;
216 4         8 my @copy_files = @{$self->regenerate};
  4         127  
217 4         9 my @plugins;
218 4 100       28 push @plugins, 'RewriteVersion',
219             [NextRelease => { format => '%-9v %{yyyy-MM-dd HH:mm:ss VVV}d%{ (TRIAL RELEASE)}T' }]
220             if $versions;
221 4 50       15 push @plugins,
222             [CopyFilesFromRelease => { filename => [@copy_files] }],
223             ['Regenerate::AfterReleasers' => { plugin => $self->name . '/CopyFilesFromRelease' }],
224             if @copy_files;
225 4 100       13 push @plugins, 'BumpVersionAfterRelease' if $versions;
226 4         17 return @plugins;
227             }
228              
229             sub pluginset_releaser {
230 9     9 0 34 my ($self) = @_;
231 9 50       80 return $ENV{FAKE_RELEASE} ? 'FakeRelease' : 'UploadToCPAN';
232             }
233              
234             sub pluginset_metaprovides {
235 4     4 0 12 my ($self) = @_;
236 4 100       143 if ($self->managed_versions) {
237 3         14 return 'MetaProvides::Package';
238             } else {
239 1         9 return ['MetaProvides::Package' => { inherit_version => 0 }];
240             }
241             }
242              
243             sub pluginset_execdir {
244 8     8 0 19 my ($self) = @_;
245 8         253 my $installer = $self->installer;
246 8 100       54 if ($installer =~ m/^ModuleBuildTiny/) {
247 2         11 return ['ExecDir' => {dir => 'script'}];
248             } else {
249 6         21 return 'ExecDir';
250             }
251             }
252              
253             __PACKAGE__->meta->make_immutable;
254             1;
255              
256             =head1 NAME
257              
258             Dist::Zilla::PluginBundle::Starter - A minimal Dist::Zilla plugin bundle
259              
260             =head1 SYNOPSIS
261              
262             ; dist.ini
263             name = My-Cool-Distribution
264             author = Example Jones <jones@example.com>
265             license = Perl_5
266             copyright_holder = Example Jones
267             copyright_year = 2017
268             version = 0.001
269            
270             [@Starter] ; all that is needed to start
271             revision = 5 ; always defaults to revision 1
272            
273             ; configuring examples
274             installer = ModuleBuildTiny
275             -remove = GatherDir ; to use [Git::GatherDir] instead, for example
276             ExecDir.dir = script ; change the directory used by [ExecDir]
277             managed_versions = 1 ; uses the main module version, and bumps module versions after release
278             regenerate = LICENSE ; copy LICENSE to root after release and dzil regenerate
279              
280             [@Starter::Git] ; drop-in variant bundle for git workflows
281             revision = 5 ; requires/defaults to revision 3
282              
283             =head1 DESCRIPTION
284              
285             The C<[@Starter]> plugin bundle for L<Dist::Zilla> is designed to do the
286             minimal amount of work to release a complete distribution reliably. It is
287             similar in purpose to L<[@Basic]|Dist::Zilla::PluginBundle::Basic>, but with
288             additional features to stay up to date and allow greater customization. The
289             selection of included plugins is intended to be unopinionated and unobtrusive,
290             so that it is usable for any well-formed CPAN distribution.
291              
292             C<[@Starter]> supports bundle revisions specified as an option, in order to
293             allow authors to opt-in to future changes to distribution packaging and
294             releasing practices. Existing revisions and the default revision number will
295             not be changed, to preserve consistent functionality in existing F<dist.ini>
296             configurations.
297              
298             You probably want L<[@Starter::Git]|Dist::Zilla::PluginBundle::Starter::Git>,
299             an extension of this bundle, if you are using a git-based workflow.
300              
301             L<Dist::Milla> is another simple, if opinionated, way to use L<Dist::Zilla>
302             without requiring any configuration ("convention over configuration"), and
303             performing all of the tasks in L</"EXTENDING"> by default. The C<[@Starter]>
304             bundle can also be configured to operate much like L<Dist::Milla>, as in the
305             L</"Dist::Milla equivalent"> example.
306              
307             =head1 GETTING STARTED
308              
309             The L<Dist::Zilla::Starter> guide is a starting point if you are new to
310             L<Dist::Zilla> or CPAN distribution building.
311              
312             For one-line initialization of a new C<[@Starter]>-based distribution, try
313             L<Dist::Zilla::MintingProfile::Starter> (or
314             L<Dist::Zilla::MintingProfile::Starter::Git>).
315              
316             Migrating from C<[@Basic]> is easy for most cases. The core of the bundle is
317             the same, so just make sure to remove any extra plugins that C<[@Starter]>
318             already includes, and configure the included plugins if needed. Migrating a
319             more complex set of plugins, including some that interact with the additional
320             generated files, may require more careful consideration.
321              
322             See L</"EXAMPLES"> for example configurations of this bundle, L</"CONFIGURING">
323             for suggestions to customize the bundle to your needs, and L</"EXTENDING"> for
324             examples of other common tasks L<Dist::Zilla> can facilitate.
325              
326             =head1 OPTIONS
327              
328             C<[@Starter]> currently only has a few direct options; it can be further
329             configured by the composed roles, as in L</"CONFIGURING">.
330              
331             =head2 revision
332              
333             [@Starter]
334             revision = 5
335              
336             Selects the revision to use, from L</"REVISIONS">. Defaults to revision 1.
337              
338             =head2 installer
339              
340             Requires revision 2 or higher.
341              
342             [@Starter]
343             revision = 2
344             installer = ModuleBuildTiny
345              
346             [@Starter]
347             revision = 2
348             installer = MakeMaker::Awesome
349             MakeMaker::Awesome.WriteMakefile_arg[0] = (clean => { FILES => 't/generated/*' })
350              
351             [@Starter]
352             revision = 5
353             installer = ModuleBuild
354             ModuleBuild.mb_class = My::Module::Builder
355              
356             The default installer is L<[MakeMaker]|Dist::Zilla::Plugin::MakeMaker>, which
357             works with no extra configuration for most cases. The C<installer> option can
358             be used to replace it with one of the following supported installers, which can
359             then be configured in the same way as shown in L</"CONFIGURING">.
360              
361             L<[MakeMaker::Awesome]|Dist::Zilla::Plugin::MakeMaker::Awesome> is useful if
362             you need to customize the generated F<Makefile.PL>.
363              
364             L<[ModuleBuildTiny]|Dist::Zilla::Plugin::ModuleBuildTiny> will generate a
365             simple F<Build.PL> using L<Module::Build::Tiny>, but this may not work
366             correctly with old versions of the L<CPAN>.pm installer or if you use features
367             incompatible with L<Module::Build::Tiny>.
368              
369             L<[ModuleBuildTiny::Fallback]|Dist::Zilla::Plugin::ModuleBuildTiny::Fallback>
370             generates a more complex F<Build.PL> that uses L<Module::Build::Tiny> by
371             default, but falls back to L<Module::Build> on old versions of the L<CPAN>.pm
372             installer that don't understand configure dependencies.
373              
374             When using a L<Module::Build::Tiny>-based installer, the
375             L<[ExecDir]|Dist::Zilla::Plugin::ExecDir> plugin will be set to mark the
376             F<script/> directory for executables instead of the default F<bin/>.
377              
378             Since revision 5, L<[ModuleBuild]|Dist::Zilla::Plugin::ModuleBuild> is
379             supported as an installer, and will generate a F<Build.PL> that uses
380             L<Module::Build>. This is not generally recommended unless converting a
381             distribution that is already using a L<Module::Build> subclass.
382              
383             =head2 managed_versions
384              
385             Requires revision 3 or higher.
386              
387             [@Starter]
388             revision = 3
389             managed_versions = 1
390              
391             With C<managed_versions> set, C<[@Starter]> will use an additional set of
392             plugins to manage your module versions when releasing, while leaving them in
393             place in the source files.
394              
395             L<[RewriteVersion]|Dist::Zilla::Plugin::RewriteVersion> will read the
396             distribution version from the main module, and set all other module versions to
397             match in the build. L<[NextRelease]|Dist::Zilla::Plugin::NextRelease> replaces
398             C<{{$NEXT}}> in your F<Changes> file with a line containing the distribution
399             version and build date/time. Finally,
400             L<[BumpVersionAfterRelease]|Dist::Zilla::Plugin::BumpVersionAfterRelease> will
401             bump the versions in your source module files after a release.
402              
403             When using this option, you B<must> have the distribution version set in your
404             main module in a form like C<our $VERSION = '1.234';>, rather than in
405             F<dist.ini>. Other modules and scripts must also have similar version
406             declarations to be updated appropriately. You can set your distribution's
407             version manually by changing the version of your main module, or by setting the
408             C<V> environment variable when building or releasing. See the documentation for
409             each plugin mentioned above for details on configuring them, which can be done
410             in the usual config-slicing way as shown in L</"CONFIGURING">.
411              
412             This option also enables the C<inherit_version> option for
413             L<[MetaProvides::Package]|Dist::Zilla::Plugin::MetaProvides::Package> since all
414             module versions are matched to the main module in this configuration.
415              
416             =head2 regenerate
417              
418             Requires revision 3 or higher.
419              
420             [@Starter]
421             revision = 3
422             regenerate = INSTALL
423             regenerate = README
424              
425             The specified generated files will be copied to the root directory upon
426             release using L<[CopyFilesFromRelease]|Dist::Zilla::Plugin::CopyFilesFromRelease>,
427             and excluded from the C<[GatherDir]> plugin in use. Note: if you remove the
428             built-in C<[GatherDir]> plugin to use one separately, you must exclude copied
429             files from that plugin yourself. Additionally,
430             L<[Regenerate::AfterReleasers]|Dist::Zilla::Plugin::Regenerate::AfterReleasers>
431             is applied to C<[CopyFilesFromRelease]> to allow these files to be generated
432             and copied on demand outside of a release using
433             L<< C<dzil regenerate>|Dist::Zilla::App::Command::regenerate >>.
434              
435             =head1 REVISIONS
436              
437             The C<[@Starter]> plugin bundle supports the following revisions.
438              
439             =head2 Revision 1
440              
441             Revision 1 is the default and is equivalent to using the following plugins:
442              
443             =over 2
444              
445             =item L<[GatherDir]|Dist::Zilla::Plugin::GatherDir>
446              
447             =item L<[MetaYAML]|Dist::Zilla::Plugin::MetaYAML>
448              
449             =item L<[MetaJSON]|Dist::Zilla::Plugin::MetaJSON>
450              
451             =item L<[License]|Dist::Zilla::Plugin::License>
452              
453             =item L<[ReadmeAnyFromPod]|Dist::Zilla::Plugin::ReadmeAnyFromPod>
454              
455             =item L<[PodSyntaxTests]|Dist::Zilla::Plugin::PodSyntaxTests>
456              
457             =item L<[Test::ReportPrereqs]|Dist::Zilla::Plugin::Test::ReportPrereqs>
458              
459             =item L<[Test::Compile]|Dist::Zilla::Plugin::Test::Compile>
460              
461             xt_mode = 1
462              
463             =item L<[MakeMaker]|Dist::Zilla::Plugin::MakeMaker>
464              
465             =item L<[Manifest]|Dist::Zilla::Plugin::Manifest>
466              
467             =item L<[PruneCruft]|Dist::Zilla::Plugin::PruneCruft>
468              
469             =item L<[ManifestSkip]|Dist::Zilla::Plugin::ManifestSkip>
470              
471             =item L<[RunExtraTests]|Dist::Zilla::Plugin::RunExtraTests>
472              
473             =item L<[TestRelease]|Dist::Zilla::Plugin::TestRelease>
474              
475             =item L<[ConfirmRelease]|Dist::Zilla::Plugin::ConfirmRelease>
476              
477             =item L<[UploadToCPAN]|Dist::Zilla::Plugin::UploadToCPAN>
478              
479             =item L<[MetaConfig]|Dist::Zilla::Plugin::MetaConfig>
480              
481             =item L<[MetaNoIndex]|Dist::Zilla::Plugin::MetaNoIndex>
482              
483             directory = t
484             directory = xt
485             directory = inc
486             directory = share
487             directory = eg
488             directory = examples
489              
490             =item L<[MetaProvides::Package]|Dist::Zilla::Plugin::MetaProvides::Package>
491              
492             =item L<[ShareDir]|Dist::Zilla::Plugin::ShareDir>
493              
494             =item L<[ExecDir]|Dist::Zilla::Plugin::ExecDir>
495              
496             =back
497              
498             This revision differs from L<[@Basic]|Dist::Zilla::PluginBundle::Basic> as
499             follows:
500              
501             =over 2
502              
503             =item *
504              
505             Uses L<[ReadmeAnyFromPod]|Dist::Zilla::Plugin::ReadmeAnyFromPod>
506             instead of L<[Readme]|Dist::Zilla::Plugin::Readme>.
507              
508             =item *
509              
510             Uses L<[RunExtraTests]|Dist::Zilla::Plugin::RunExtraTests> instead of
511             L<[ExtraTests]|Dist::Zilla::Plugin::ExtraTests>.
512              
513             =item *
514              
515             Includes the following additional plugins:
516             L<[MetaJSON]|Dist::Zilla::Plugin::MetaJSON>,
517             L<[PodSyntaxTests]|Dist::Zilla::Plugin::PodSyntaxTests>,
518             L<[Test::ReportPrereqs]|Dist::Zilla::Plugin::Test::ReportPrereqs>,
519             L<[Test::Compile]|Dist::Zilla::Plugin::Test::Compile>,
520             L<[MetaConfig]|Dist::Zilla::Plugin::MetaConfig>,
521             L<[MetaNoIndex]|Dist::Zilla::Plugin::MetaNoIndex>,
522             L<[MetaProvides::Package]|Dist::Zilla::Plugin::MetaProvides::Package>.
523              
524             =back
525              
526             =head2 Revision 2
527              
528             Revision 2 is similar to Revision 1, with these differences:
529              
530             =over 2
531              
532             =item *
533              
534             Sets the option
535             L<"inherit_version" in [MetaProvides::Package]|Dist::Zilla::Plugin::MetaProvides::Package/"inherit_version">
536             to 0 by default, so that C<provides> metadata will use individual module
537             versions if they differ from the distribution version.
538              
539             =item *
540              
541             L<[Pod2Readme]|Dist::Zilla::Plugin::Pod2Readme> is used instead of
542             L<[ReadmeAnyFromPod]|Dist::Zilla::Plugin::ReadmeAnyFromPod> to generate the
543             plaintext F<README>, as it is a simpler plugin for this purpose. It takes the
544             same C<filename> and C<source_filename> options, but does not allow further
545             configuration, and does not automatically use a C<.pod> file as the source.
546              
547             =item *
548              
549             The L</"installer"> option is now supported to change the installer plugin.
550              
551             =back
552              
553             =head2 Revision 3
554              
555             Revision 3 is similar to Revision 2, but additionally supports the
556             L</"managed_versions"> and L</"regenerate"> options, and variant bundles like
557             L<[@Starter::Git]|Dist::Zilla::PluginBundle::Starter::Git>.
558              
559             =head2 Revision 4
560              
561             Revision 4 is similar to Revision 3, but removes the
562             L<[MetaConfig]|Dist::Zilla::Plugin::MetaConfig> plugin because it adds
563             significant clutter to the generated META files without much benefit. It can
564             easily be added to the F<dist.ini> if desired.
565              
566             =head2 Revision 5
567              
568             Revision 5 is similar to Revision 4, with these differences:
569              
570             =over 2
571              
572             =item *
573              
574             Includes an instance of the L<[PruneFiles]|Dist::Zilla::Plugin::PruneFiles>
575             plugin to remove F<README.pod> from the distribution build if present. The CPAN
576             toolchain expects C<.pod> files to be documentation and installs them alongside
577             the module files, even if they are not within the F<lib/> directory, due to
578             historical distribution layouts. But this is not the purpose of F<README.pod>,
579             so it is excluded from the build to avoid cluttering users' install locations
580             and confusing MetaCPAN and similar documentation indexes. F<README.pod> files
581             generated in the source tree using
582             L<[ReadmeAnyFromPod]|Dist::Zilla::Plugin::ReadmeAnyFromPod> (with
583             C<location = root>) are already automatically excluded from the build by that
584             plugin.
585              
586             =item *
587              
588             The L</"installer"> option now supports C<ModuleBuild>.
589              
590             =back
591              
592             =head1 EXAMPLES
593              
594             Some example F<dist.ini> configurations to get started with.
595              
596             =head2 Just the basics
597              
598             name = Acme-Foo
599             author = Jane Doe <example@example.com>
600             license = Artistic_2_0
601             copyright_holder = Jane Doe
602             copyright_year = 2019
603             version = 1.00
604              
605             [@Starter]
606             revision = 5
607              
608             [Prereqs / RuntimeRequires]
609             perl = 5.010001
610             Exporter = 5.57
611             Path::Tiny = 0
612              
613             [Prereqs / TestRequires]
614             Test::More = 0.88
615              
616             =head2 Managed boilerplate
617              
618             name = Acme-Foo
619             author = Jane Doe <example@example.com>
620             license = Artistic_2_0
621             copyright_holder = Jane Doe
622             copyright_year = 2019
623              
624             [@Starter::Git]
625             revision = 5
626             managed_versions = 1
627             regenerate = Makefile.PL
628             regenerate = META.json
629             regenerate = LICENSE
630              
631             [AutoPrereqs]
632              
633             =head2 Dist::Milla equivalent
634              
635             [CheckChangesHasContent]
636              
637             [ReadmeAnyFromPod]
638             type = markdown
639             filename = README.md
640             location = root
641             phase = release
642             [Regenerate::AfterReleasers]
643             plugin = ReadmeAnyFromPod
644              
645             [@Starter::Git]
646             revision = 5
647             installer = ModuleBuildTiny
648             managed_versions = 1
649             regenerate = Build.PL
650             regenerate = META.json
651             regenerate = LICENSE
652             ExecDir.dir = script
653             Release_Commit.allow_dirty[] = README.md
654             BumpVersionAfterRelease.munge_build_pl = 0
655              
656             [NameFromDirectory]
657             [LicenseFromModule]
658             override_author = 1
659             [Prereqs::FromCPANfile]
660             [StaticInstall]
661             mode = auto
662             [GithubMeta]
663             issues = 1
664             [Git::Contributors]
665              
666             =head1 CONFIGURING
667              
668             By using the L<PluginRemover|Dist::Zilla::Role::PluginBundle::PluginRemover> or
669             L<Config::Slicer|Dist::Zilla::Role::PluginBundle::Config::Slicer> role options,
670             the C<[@Starter]> bundle's included plugins can be customized as desired. Here
671             are some examples:
672              
673             =head2 GatherDir
674              
675             If the distribution is using git source control, it is often helpful to replace
676             the default L<[GatherDir]|Dist::Zilla::Plugin::GatherDir> plugin with
677             L<[Git::GatherDir]|Dist::Zilla::Plugin::Git::GatherDir>. (Note: The
678             L<[@Starter::Git]|Dist::Zilla::PluginBundle::Starter::Git> variant of this
679             bundle uses C<[Git::GatherDir]> by default.)
680              
681             [Git::GatherDir]
682             [@Starter]
683             -remove = GatherDir
684              
685             The included L<[GatherDir]|Dist::Zilla::Plugin::GatherDir> plugin can
686             alternatively be configured directly. (See
687             L<Config::MVP::Slicer/"CONFIGURATION SYNTAX"> for an explanation of the
688             subscripts for slicing array attributes.)
689              
690             [@Starter]
691             GatherDir.include_dotfiles = 1
692             GatherDir.exclude_filename[0] = foo_bar.txt
693             GatherDir.prune_directory[] = ^temp
694              
695             =head2 Readme
696              
697             The L<[Pod2Readme]|Dist::Zilla::Plugin::Pod2Readme> or
698             L<[ReadmeAnyFromPod]|Dist::Zilla::Plugin::ReadmeAnyFromPod> plugin (depending
699             on bundle revision) generates a plaintext F<README> from the POD text in the
700             distribution's L<Dist::Zilla/"main_module"> by default, but can be configured
701             to look elsewhere. The standard F<README> should always be plaintext, but in
702             order to generate a non-plaintext F<README> in addition,
703             L<[ReadmeAnyFromPod]|Dist::Zilla::Plugin::ReadmeAnyFromPod> can simply be used
704             separately.
705              
706             [@Starter]
707             revision = 2
708             Pod2Readme.source_filename = bin/foobar
709            
710             [ReadmeAnyFromPod / Markdown_Readme]
711             type = markdown
712             filename = README.md
713            
714             [ReadmeAnyFromPod / Pod_Readme]
715             type = pod
716             location = root ; do not include pod readmes in the build!
717             phase = release ; avoid changing files in the root with dzil build or dzil test
718             [Regenerate::AfterReleasers] ; allows regenerating with dzil regenerate
719             plugin = Pod_Readme
720              
721             Alternatively, you can remove the default F<README> plugin to ship a manually
722             maintained file, or generate one with another plugin such as
723             L<[Readme::Brief]|Dist::Zilla::Plugin::Readme::Brief>.
724              
725             [Readme::Brief]
726             [@Starter]
727             revision = 2
728             -remove = Pod2Readme
729              
730             =head2 MetaNoIndex
731              
732             The distribution may include additional files or directories that should not
733             have their contents indexed as CPAN modules. (See
734             L<Config::MVP::Slicer/"CONFIGURATION SYNTAX"> for an explanation of the
735             subscripts for slicing array attributes.)
736              
737             [@Starter]
738             MetaNoIndex.file[0] = eggs/FooBar.pm
739             MetaNoIndex.directory[a] = eggs
740             MetaNoIndex.directory[b] = bacon
741              
742             =head2 MetaProvides
743              
744             The L<[MetaProvides::Package]|Dist::Zilla::Plugin::MetaProvides::Package>
745             plugin will use the distribution's version (as set in F<dist.ini> or by a
746             plugin) as the version of each module when populating the C<provides> metadata
747             by default. If the distribution does not have uniform module versions, the
748             plugin can be configured to reflect each module's hardcoded version where
749             available, by setting the C<inherit_version> option to 0 (the default in bundle
750             L</"Revision 2">).
751              
752             [@Starter]
753             MetaProvides::Package.inherit_version = 0 ; default in revision 2
754              
755             With this option set to 0, it will use the main distribution version as a
756             fallback for any module where a version is not found. This can also be
757             overridden, so that if no version is found for a module, no version will be
758             specified for it in metadata, by setting C<inherit_missing> to 0 as well.
759              
760             [@Starter]
761             MetaProvides::Package.inherit_version = 0
762             MetaProvides::Package.inherit_missing = 0
763              
764             =head2 ExecDir
765              
766             Some distributions use the F<script/> directory instead of F<bin/> (the
767             L<[ExecDir]|Dist::Zilla::Plugin::ExecDir> default) for executable scripts.
768              
769             [@Starter]
770             ExecDir.dir = script
771              
772             =head2 Versions
773              
774             When using the L</"managed_versions"> option, the additional plugins can be
775             directly configured in various ways to suit your versioning needs.
776              
777             [@Starter]
778             revision = 3
779             managed_versions = 1
780            
781             ; configuration examples
782             RewriteVersion.global = 1
783             BumpVersionAfterRelease.munge_makefile_pl = 0
784             NextRelease.filename = ChangeLog
785             NextRelease.format = %-5v %{yyyy-MM-dd}d
786              
787             =head1 EXTENDING
788              
789             This bundle includes a basic set of plugins for releasing a distribution, but
790             there are many more common non-intrusive tasks that L<Dist::Zilla> can help
791             with simply by using additional plugins in the F<dist.ini>. You can install all
792             plugins required by a F<dist.ini> by running
793             C<dzil authordeps --missing | cpanm> or with
794             L<< C<dzil installdeps>|Dist::Zilla::App::Command::installdeps >>.
795              
796             =head2 Name
797              
798             To automatically set the distribution name from the project directory name, use
799             L<[NameFromDirectory]|Dist::Zilla::Plugin::NameFromDirectory>.
800              
801             =head2 License and Copyright
802              
803             To extract the license and copyright information from the main module
804             documentation, and optionally set the author as well, use
805             L<[LicenseFromModule]|Dist::Zilla::Plugin::LicenseFromModule>.
806              
807             =head2 Changelog
808              
809             To automatically add the new release version to the distribution changelog,
810             use L<[NextRelease]|Dist::Zilla::Plugin::NextRelease> as the L</"managed_versions">
811             option does. To ensure the release has changelog entries, use
812             L<[CheckChangesHasContent]|Dist::Zilla::Plugin::CheckChangesHasContent>.
813              
814             =head2 Git
815              
816             To better integrate with a git workflow, use the plugins from
817             L<[@Git]|Dist::Zilla::PluginBundle::Git>, as the
818             L<[@Starter::Git]|Dist::Zilla::PluginBundle::Starter::Git> variant of this
819             bundle does. To automatically add contributors to metadata from git commits,
820             use L<[Git::Contributors]|Dist::Zilla::Plugin::Git::Contributors>.
821              
822             =head2 Resources
823              
824             To automatically set resource metadata from an associated GitHub repository,
825             use L<[GithubMeta]|Dist::Zilla::Plugin::GithubMeta>. To set resource metadata
826             manually, use L<[MetaResources]|Dist::Zilla::Plugin::MetaResources>.
827              
828             =head2 Prereqs
829              
830             To specify distribution prereqs in a L<cpanfile>, use
831             L<[Prereqs::FromCPANfile]|Dist::Zilla::Plugin::Prereqs::FromCPANfile>. To
832             specify prereqs in a F<prereqs.json> or F<prereqs.yml>, use
833             L<[PrereqsFile]|Dist::Zilla::Plugin::PrereqsFile>. To specify prereqs in
834             F<dist.ini>, use L<[Prereqs]|Dist::Zilla::Plugin::Prereqs>. To automatically
835             guess the distribution's prereqs by parsing the code, use
836             L<[AutoPrereqs]|Dist::Zilla::Plugin::AutoPrereqs>.
837              
838             =head1 ENVIRONMENT
839              
840             The C<FAKE_RELEASE> environment variable is supported as in L<Dist::Milla> and
841             L<Minilla>. It replaces the L<[UploadToCPAN]|Dist::Zilla::Plugin::UploadToCPAN>
842             plugin with L<[FakeRelease]|Dist::Zilla::Plugin::FakeRelease>, to test the
843             release process (including any version bumping and commits!) without actually
844             uploading to CPAN.
845              
846             $ FAKE_RELEASE=1 dzil release
847              
848             =head1 BUGS
849              
850             Report any issues on the public bugtracker.
851              
852             =head1 AUTHOR
853              
854             Dan Book <dbook@cpan.org>
855              
856             =head1 COPYRIGHT AND LICENSE
857              
858             This software is Copyright (c) 2016 by Dan Book.
859              
860             This is free software, licensed under:
861              
862             The Artistic License 2.0 (GPL Compatible)
863              
864             =head1 SEE ALSO
865              
866             L<Dist::Zilla>, L<Dist::Zilla::PluginBundle::Basic>,
867             L<Dist::Zilla::Starter>, L<Dist::Zilla::PluginBundle::Starter::Git>,
868             L<Dist::Zilla::MintingProfile::Starter>, L<Dist::Milla>