1 package Dist
::Zilla
::PluginBundle
::Author
::CCM
;
2 # ABSTRACT: A plugin bundle for distributions built by CCM
3 # KEYWORDS: dzil author bundle distribution tool
7 # In your dist.ini file:
12 You probably don't want to use this.
21 exclude_filename = LICENSE
22 exclude_filename = README.md
33 [Prereqs::FromCPANfile] ; if a cpanfile exists in root
43 [Test::MinimumVersion]
44 max_target_perl = 5.10.1
49 [Test::CleanNamespaces]
63 [MetaProvides::Package]
72 config_plugin = @Author::CCM
87 build_branch = /^(dist|build\/.*)$/
91 [MakeMaker] ; override with the "installer" attribute
95 [CheckChangesHasContent]
100 [UploadToCPAN] ; disable with the "no_upload" attribute
102 commit_msg = Release %N %v%t%n%n%c
105 release_branch = dist
106 release_message = Version %v%t
108 tag_message = Version %v%t%n%n%c
110 push_to = origin master +master:refs/heads/release +dist
111 remotes_must_exist = 0
117 * L<Dist::Zilla::PluginBundle::Author::ETHER>
125 our $VERSION = '999.999'; # VERSION
127 use Dist
::Zilla
::Util
;
130 use namespace
::autoclean
;
132 =attr max_target_perl
134 Specify the minimum perl version
. Defaults to C
<5.10.1>.
138 has max_target_perl
=> (
144 $self->payload->{'Test::MinimumVersion.max_target_perl'} // $self->payload->{max_target_perl
} // '5.10.1';
150 Specify the release authority
. Defaults to C
<cpan
:CCM
>.
160 $self->payload->{'Authority.authority'} // $self->payload->{authority
} // 'cpan:CCM';
166 Specify which installer to
use, such as
:
169 * C<MakeMaker> (default)
170 * C<MakeMaker::Custom>
178 default => sub { shift-
>payload->{installer
} // 'MakeMaker' },
183 Disable plugins that
use the network
, and prevent releasing
.
191 default => sub { $ENV{DZIL_AIRPLANE
} // shift-
>payload->{airplane
} // 0 },
196 Do
not upload to CPAN
or git
push.
204 default => sub { $ENV{DZIL_NO_UPLOAD
} // shift-
>payload->{no_upload
} // 0 },
209 Required by L
<Dist
::Zilla
::Role
::PluginBundle
::Easy
>.
216 my @copy_from_build = qw(LICENSE);
217 my @network_plugins = qw(Git::Push Test::Pod::No404s UploadToCPAN);
218 my @gather_exclude = (@copy_from_build, qw(README.md));
219 my @gather_prune = qw(dist.ini);
220 my @no_index = qw(eg share shares t xt);
221 my @allow_dirty = (@copy_from_build, qw(.travis.yml Changes LICENSE README.md));
222 my @git_remotes = qw(github origin);
223 my @check_files = qw(:InstallModules :ExecFiles :TestFiles :ExtraTestFiles);
224 my $perl_version_target = $self->max_target_perl;
225 my ($perl_version, $perl_version_build) = $self->_travis_perl_versions($perl_version_target);
227 if ($self->no_upload) {
228 say '[@Author::CCM] WARNING! WARNING! WARNING! *** You are in no_upload mode!! ***';
231 if (!$self->payload->{'TravisYML.support_builddir'}) {
232 # swap perl_version and perl_version_build because DZP::TravisYML got it backwards!
233 # https://github.com/SineSwiper/Dist-Zilla-TravisCI/pull/40
235 my $tmp = $self->payload->{'TravisYML.perl_version_build'};
236 if (defined $self->payload->{'TravisYML.perl_version'}) {
237 $self->payload->{'TravisYML.perl_version_build'} = $self->payload->{'TravisYML.perl_version'}
240 delete $self->payload->{'TravisYML.perl_version_build'};
243 $self->payload->{'TravisYML.perl_version'} = $tmp;
246 delete $self->payload->{'TravisYML.perl_version'};
249 ($perl_version, $perl_version_build) = ($perl_version_build, $perl_version);
255 ['Git::NextVersion'],
256 ['ReversionOnRelease' => {prompt
=> 1}],
259 ['Git::GatherDir' => {exclude_filename
=> [@gather_exclude]}],
261 ['PruneFiles' => {filename
=> [@gather_prune]}],
263 ['CopyFilesFromBuild' => {copy
=> [@copy_from_build]}],
268 -f
'cpanfile' ? ['Prereqs::FromCPANfile'] : (),
269 ['Prereqs::AuthorDeps'],
273 ['Test::CPAN::Changes'],
274 ['PodCoverageTests'],
276 ['Test::Pod::No404s'],
278 ['Test::MinimumVersion' => {max_target_perl
=> $perl_version_target}],
279 ['Test::EOL' => {finder
=> [@check_files]}],
280 ['Test::NoTabs' => {finder
=> [@check_files]}],
281 ['Test::Perl::Critic'],
282 ['Test::Portability'],
283 ['Test::CleanNamespaces'],
284 ['Test::ReportPrereqs'],
287 ['Authority' => {authority
=> $self->authority, do_munging
=> 0}],
290 ['MetaNoIndex' => {directory
=> [@no_index]}],
291 ['MetaProvides::Package'],
293 ['Git::Contributors' => {order_by
=> 'commits'}],
294 ['GithubMeta' => {remote
=> [@git_remotes], issues
=> 1}],
297 ['PodWeaver' => {config_plugin
=> '@Author::CCM'}],
298 ['OverridePkgVersion'],
302 ['ReadmeAnyFromPod' => 'RepoReadme' => {filename
=> 'README.md', location
=> 'root', type
=> 'markdown', phase
=> 'release'}],
303 ['ReadmeAnyFromPod' => 'DistReadme' => {filename
=> 'README', location
=> 'build', type
=> 'text'}],
304 ['TravisYML' => {build_branch
=> '/^(dist|build\/.*)$/', perl_version
=> $perl_version, perl_version_build
=> $perl_version_build}],
308 $self->installer, # e.g. MakeMaker
312 ['CheckChangesHasContent'],
313 ['Git::Check' => {allow_dirty
=> [@allow_dirty], untracked_files
=> 'ignore'}],
316 # ['ConfirmRelease'],
317 $self->no_upload ? ['FakeRelease'] : ['UploadToCPAN'],
318 ['Git::Commit' => {allow_dirty
=> [@allow_dirty], commit_msg
=> 'Release %N %v%t%n%n%c'}],
319 ['Git::CommitBuild' => {branch
=> '', release_branch
=> 'dist', release_message
=> 'Version %v%t'}],
320 ['Git::Tag' => {tag_message
=> 'Version %v%t%n%n%c'}],
321 $self->no_upload ? () : ['Git::Push' => {push_to
=> 'origin master +master:refs/heads/release +dist', remotes_must_exist
=> 0}],
325 if ($self->airplane) {
326 my %network_plugins = map { Dist
::Zilla
::Util-
>expand_config_package_name($_) => 1 } @network_plugins;
328 @plugins = grep { !$network_plugins{Dist
::Zilla
::Util-
>expand_config_package_name(ref eq 'ARRAY' ? $_->[0] : $_)} } @plugins;
329 push @plugins, 'BlockRelease';
332 push @plugins, 'ConfirmRelease';
334 $self->add_plugins(@plugins);
337 sub _travis_perl_versions
{
340 my $perl_version_target = Perl
::Version-
>new(shift or die 'Missing target version');
341 my $min_version = Perl
::Version-
>new('5.14');
342 my $min_version_build = Perl
::Version-
>new($perl_version_target);
343 $min_version_build->subversion(0);
348 for my $v (qw{5.26 5.24 5.22 5.20 5.18 5.16 5.14 5.12 5.10 5.8}) {
349 my $version = Perl
::Version-
>new($v);
350 push @versions, "$version" if $version >= $min_version_build && $version >= $min_version;
351 push @versions_build, "$version" if $version >= $min_version_build;
354 my $perl_version = join(' ', @versions);
355 my $perl_version_build = join(' ', @versions_build);
357 return ($perl_version, $perl_version_build);
360 with
'Dist::Zilla::Role::PluginBundle::Easy';
361 with
'Dist::Zilla::Role::PluginBundle::PluginRemover';
362 with
'Dist::Zilla::Role::PluginBundle::Config::Slicer';
364 __PACKAGE__-
>meta->make_immutable;