]>
Dogcows Code - chaz/p5-Dist-Zilla-PluginBundle-Author-CCM/blob - lib/Dist/Zilla/PluginBundle/Author/CCM.pm
1 package Dist
::Zilla
::PluginBundle
::Author
::CCM
;
2 # ABSTRACT: A plugin bundle for distributions built by CCM
3 # KEYWORDS: dzil author bundle distribution tool
10 our $VERSION = '0.008001'; # VERSION
12 use Dist
::Zilla
::Util
;
15 use namespace
::autoclean
;
18 has max_target_perl
=> (
24 $self->payload->{'Test::MinimumVersion.max_target_perl'} // $self->payload->{max_target_perl
} // '5.10.1';
35 $self->payload->{'Authority.authority'} // $self->payload->{authority
} // 'cpan:CCM';
44 default => sub { shift-
>payload->{installer
} // 'MakeMaker' },
52 default => sub { $ENV{DZIL_AIRPLANE
} // shift-
>payload->{airplane
} // 0 },
60 default => sub { $ENV{DZIL_NO_UPLOAD
} // shift-
>payload->{no_upload
} // 0 },
67 my @copy_from_build = qw(LICENSE);
68 my @network_plugins = qw(Git::Push Test::Pod::No404s UploadToCPAN);
69 my @gather_exclude = (@copy_from_build, qw(README.md));
70 my @gather_prune = qw(dist.ini);
71 my @no_index = qw(eg share shares t xt);
72 my @allow_dirty = (@copy_from_build, qw(.travis.yml Changes LICENSE README.md));
73 my @git_remotes = qw(github origin);
74 my @check_files = qw(:InstallModules :ExecFiles :TestFiles :ExtraTestFiles);
75 my $perl_version_target = $self->max_target_perl;
76 my ($perl_version, $perl_version_build) = $self->_travis_perl_versions($perl_version_target);
78 if ($self->no_upload) {
79 say '[@Author::CCM] WARNING! WARNING! WARNING! *** You are in no_upload mode!! ***';
82 if (!$self->payload->{'TravisYML.support_builddir'}) {
83 # swap perl_version and perl_version_build because DZP::TravisYML got it backwards!
84 # https://github.com/SineSwiper/Dist-Zilla-TravisCI/pull/40
86 my $tmp = $self->payload->{'TravisYML.perl_version_build'};
87 if (defined $self->payload->{'TravisYML.perl_version'}) {
88 $self->payload->{'TravisYML.perl_version_build'} = $self->payload->{'TravisYML.perl_version'}
91 delete $self->payload->{'TravisYML.perl_version_build'};
94 $self->payload->{'TravisYML.perl_version'} = $tmp;
97 delete $self->payload->{'TravisYML.perl_version'};
100 ($perl_version, $perl_version_build) = ($perl_version_build, $perl_version);
106 ['Git::NextVersion'],
107 ['ReversionOnRelease' => {prompt
=> 1}],
110 ['Git::GatherDir' => {exclude_filename
=> [@gather_exclude]}],
112 ['PruneFiles' => {filename
=> [@gather_prune]}],
114 ['CopyFilesFromBuild' => {copy
=> [@copy_from_build]}],
119 -f
'cpanfile' ? ['Prereqs::FromCPANfile'] : (),
120 ['Prereqs::AuthorDeps'],
124 ['Test::CPAN::Changes'],
125 ['PodCoverageTests'],
127 ['Test::Pod::No404s'],
129 ['Test::MinimumVersion' => {max_target_perl
=> $perl_version_target}],
130 ['Test::EOL' => {finder
=> [@check_files]}],
131 ['Test::NoTabs' => {finder
=> [@check_files]}],
132 ['Test::Perl::Critic'],
133 ['Test::Portability'],
134 ['Test::CleanNamespaces'],
135 ['Test::ReportPrereqs'],
138 ['Authority' => {authority
=> $self->authority, do_munging
=> 0}],
141 ['MetaNoIndex' => {directory
=> [@no_index]}],
142 ['MetaProvides::Package'],
144 ['Git::Contributors' => {order_by
=> 'commits'}],
145 ['GithubMeta' => {remote
=> [@git_remotes], issues
=> 1}],
148 ['PodWeaver' => {config_plugin
=> '@Author::CCM'}],
149 ['OverridePkgVersion'],
153 ['ReadmeAnyFromPod' => 'RepoReadme' => {filename
=> 'README.md', location
=> 'root', type
=> 'markdown', phase
=> 'release'}],
154 ['ReadmeAnyFromPod' => 'DistReadme' => {filename
=> 'README', location
=> 'build', type
=> 'text'}],
155 ['TravisYML' => {build_branch
=> '/^(dist|build\/.*)$/', perl_version
=> $perl_version, perl_version_build
=> $perl_version_build}],
159 $self->installer, # e.g. MakeMaker
163 ['CheckChangesHasContent'],
164 ['Git::Check' => {allow_dirty
=> [@allow_dirty], untracked_files
=> 'ignore'}],
167 # ['ConfirmRelease'],
168 $self->no_upload ? ['FakeRelease'] : ['UploadToCPAN'],
169 ['Git::Commit' => {allow_dirty
=> [@allow_dirty], commit_msg
=> 'Release %N %v%t%n%n%c'}],
170 ['Git::CommitBuild' => {branch
=> '', release_branch
=> 'dist', release_message
=> 'Version %v%t'}],
171 ['Git::Tag' => {tag_message
=> 'Version %v%t%n%n%c'}],
172 $self->no_upload ? () : ['Git::Push' => {push_to
=> 'origin master +master:refs/heads/release +dist', remotes_must_exist
=> 0}],
176 if ($self->airplane) {
177 my %network_plugins = map { Dist
::Zilla
::Util-
>expand_config_package_name($_) => 1 } @network_plugins;
179 @plugins = grep { !$network_plugins{Dist
::Zilla
::Util-
>expand_config_package_name(ref eq 'ARRAY' ? $_->[0] : $_)} } @plugins;
180 push @plugins, 'BlockRelease';
183 push @plugins, 'ConfirmRelease';
185 $self->add_plugins(@plugins);
188 sub _travis_perl_versions
{
191 my $perl_version_target = Perl
::Version-
>new(shift or die 'Missing target version');
192 my $min_version = Perl
::Version-
>new('5.14');
193 my $min_version_build = Perl
::Version-
>new($perl_version_target);
194 $min_version_build->subversion(0);
199 for my $v (qw{5.26 5.24 5.22 5.20 5.18 5.16 5.14 5.12 5.10 5.8}) {
200 my $version = Perl
::Version-
>new($v);
201 push @versions, "$version" if $version >= $min_version_build && $version >= $min_version;
202 push @versions_build, "$version" if $version >= $min_version_build;
205 my $perl_version = join(' ', @versions);
206 my $perl_version_build = join(' ', @versions_build);
208 return ($perl_version, $perl_version_build);
211 with
'Dist::Zilla::Role::PluginBundle::Easy';
212 with
'Dist::Zilla::Role::PluginBundle::PluginRemover';
213 with
'Dist::Zilla::Role::PluginBundle::Config::Slicer';
215 __PACKAGE__-
>meta->make_immutable;
226 Dist::Zilla::PluginBundle::Author::CCM - A plugin bundle for distributions built by CCM
234 # In your dist.ini file:
239 You probably don't want to use this.
248 exclude_filename = LICENSE
249 exclude_filename = README.md
260 [Prereqs::FromCPANfile] ; if a cpanfile exists in root
261 [Prereqs::AuthorDeps]
265 [Test::CPAN::Changes]
270 [Test::MinimumVersion]
271 max_target_perl = 5.10.1
276 [Test::CleanNamespaces]
277 [Test::ReportPrereqs]
290 [MetaProvides::Package]
299 config_plugin = @Author::CCM
314 build_branch = /^(dist|build\/.*)$/
318 [MakeMaker] ; override with the "installer" attribute
322 [CheckChangesHasContent]
327 [UploadToCPAN] ; disable with the "no_upload" attribute
329 commit_msg = Release %N %v%t%n%n%c
332 release_branch = dist
333 release_message = Version %v%t
335 tag_message = Version %v%t%n%n%c
337 push_to = origin master +master:refs/heads/release +dist
338 remotes_must_exist = 0
342 =head2 max_target_perl
344 Specify the minimum perl version. Defaults to C<5.10.1>.
348 Specify the release authority. Defaults to C<cpan:CCM>.
352 Specify which installer to use, such as:
358 C<MakeMaker> (default)
368 Disable plugins that use the network, and prevent releasing.
372 Do not upload to CPAN or git push.
378 Required by L<Dist::Zilla::Role::PluginBundle::Easy>.
390 L<Dist::Zilla::PluginBundle::Author::ETHER>
396 Please report any bugs or feature requests on the bugtracker website
397 L<https://github.com/chazmcgarvey/Dist-Zilla-PluginBundle-Author-CCM/issues>
399 When submitting a bug or request, please include a test-file or a
400 patch to an existing test-file that illustrates the bug or desired
405 Charles McGarvey <chazmcgarvey@brokenzipper.com>
407 =head1 COPYRIGHT AND LICENSE
409 This software is copyright (c) 2016 by Charles McGarvey.
411 This is free software; you can redistribute it and/or modify it under
412 the same terms as the Perl 5 programming language system itself.
This page took 0.0555 seconds and 4 git commands to generate.