X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fp5-Dist-Zilla-PluginBundle-Author-CCM;a=blobdiff_plain;f=lib%2FDist%2FZilla%2FPluginBundle%2FAuthor%2FCCM.pm;h=7a51fd85ad2a739cf453bca0e582264e54415bb4;hp=a8a327f50a7c6ce4e36b0fdcc7a5063a1df56ec7;hb=5081d19e826a72236ef02b36ee4f205c0d0cc308;hpb=fb8925433e905ddc2f5c7dd8d74d51eff4994cbb diff --git a/lib/Dist/Zilla/PluginBundle/Author/CCM.pm b/lib/Dist/Zilla/PluginBundle/Author/CCM.pm index a8a327f..7a51fd8 100644 --- a/lib/Dist/Zilla/PluginBundle/Author/CCM.pm +++ b/lib/Dist/Zilla/PluginBundle/Author/CCM.pm @@ -13,13 +13,9 @@ You probably don't want to use this. ; VERSION [Git::NextVersion] - [NextRelease] [ReversionOnRelease] prompt = 1 - [ExecDir] - [ExtraTests] - ; GATHER [Git::GatherDir] exclude_filename = LICENSE @@ -30,6 +26,7 @@ You probably don't want to use this. [CopyFilesFromBuild] copy = LICENSE + [ExecDir] ; PREREQS [AutoPrereqs] @@ -43,6 +40,8 @@ You probably don't want to use this. [PodSyntaxTests] [Test::Pod::No404s] [Test::Compile] + [Test::MinimumVersion] + max_target_perl = 5.10.1 [Test::EOL] [Test::NoTabs] [Test::Perl::Critic] @@ -79,19 +78,23 @@ You probably don't want to use this. filename = README.md locaton = root type = markdown + phase = release [ReadmeAnyFromPod] filename = README location = build type = text [TravisYML] + build_branch = /^(dist|build\/.*)$/ [Manifest] [ManifestSkip] [MakeMaker] ; override with the "installer" attribute ; RELEASE + [NextRelease] [CheckChangesHasContent] [Git::Check] + [RunExtraTests] [TestRelease] [ConfirmRelease] [UploadToCPAN] ; disable with the "no_upload" attribute @@ -115,6 +118,7 @@ You probably don't want to use this. =cut +use 5.014; use warnings; use strict; @@ -124,6 +128,22 @@ use Dist::Zilla::Util; use Moose; use namespace::autoclean; +=attr authority + +Specify the release authority. Defaults to C. + +=cut + +has authority => ( + is => 'ro', + isa => 'Str', + lazy => 1, + default => sub { + my $self = shift; + $self->payload->{'Authority.authority'} // $self->payload->{authority} // 'cpan:CCM'; + }, +); + =attr installer Specify which installer to use, such as: @@ -156,7 +176,7 @@ has airplane => ( =attr no_upload -Do not upload to CPAN. +Do not upload to CPAN or git push. =cut @@ -164,7 +184,7 @@ has no_upload => ( is => 'ro', isa => 'Bool', lazy => 1, - default => 0, + default => sub { $ENV{DZIL_NO_UPLOAD} // shift->payload->{no_upload} // 0 }, ); =method configure @@ -176,31 +196,56 @@ Required by L. sub configure { my $self = shift; - my @copy_from_build = qw(LICENSE); - my @network_plugins = qw(Git::Push Test::Pod::No404s UploadToCPAN); - my @gather_exclude = (@copy_from_build, qw(README.md)); - my @gather_prune = qw(dist.ini); - my @no_index = qw(eg share shares t xt); - my @allow_dirty = (@copy_from_build, qw(.travis.yml Changes LICENSE README.md)); - my @git_remotes = qw(github origin); - my @check_files = qw(:InstallModules :ExecFiles :TestFiles :ExtraTestFiles); + my @copy_from_build = qw(LICENSE); + my @network_plugins = qw(Git::Push Test::Pod::No404s UploadToCPAN); + my @gather_exclude = (@copy_from_build, qw(README.md)); + my @gather_prune = qw(dist.ini); + my @no_index = qw(eg share shares t xt); + my @allow_dirty = (@copy_from_build, qw(.travis.yml Changes LICENSE README.md)); + my @git_remotes = qw(github origin); + my @check_files = qw(:InstallModules :ExecFiles :TestFiles :ExtraTestFiles); + my $perl_version_target = '5.10.1'; + my $perl_version = '5.24 5.22 5.20 5.18 5.16 5.14'; + my $perl_version_build = $perl_version . ' 5.12 5.10 -5.8'; + + if ($self->no_upload) { + say '[@Author::CCM] WARNING! WARNING! WARNING! *** You are in no_upload mode!! ***'; + } + + if (!$self->payload->{'TravisYML.support_builddir'}) { + # swap perl_version and perl_version_build because DZP::TravisYML got it backwards! + # https://github.com/SineSwiper/Dist-Zilla-TravisCI/pull/40 + + my $tmp = $self->payload->{'TravisYML.perl_version_build'}; + if (defined $self->payload->{'TravisYML.perl_version'}) { + $self->payload->{'TravisYML.perl_version_build'} = $self->payload->{'TravisYML.perl_version'} + } + else { + delete $self->payload->{'TravisYML.perl_version_build'}; + } + if (defined $tmp) { + $self->payload->{'TravisYML.perl_version'} = $tmp; + } + else { + delete $self->payload->{'TravisYML.perl_version'}; + } + + ($perl_version, $perl_version_build) = ($perl_version_build, $perl_version); + } my @plugins = ( # VERSION ['Git::NextVersion'], - ['NextRelease'], ['ReversionOnRelease' => {prompt => 1}], - ['ExecDir'], - ['ExtraTests'], - # GATHER ['Git::GatherDir' => {exclude_filename => [@gather_exclude]}], ['PruneCruft'], ['PruneFiles' => {filename => [@gather_prune]}], ['CopyFilesFromBuild' => {copy => [@copy_from_build]}], + ['ExecDir'], # PREREQS ['AutoPrereqs'], @@ -214,6 +259,7 @@ sub configure { ['PodSyntaxTests'], ['Test::Pod::No404s'], ['Test::Compile'], + ['Test::MinimumVersion' => {max_target_perl => $perl_version_target}], ['Test::EOL' => {finder => [@check_files]}], ['Test::NoTabs' => {finder => [@check_files]}], ['Test::Perl::Critic'], @@ -222,7 +268,7 @@ sub configure { ['Test::ReportPrereqs'], # METADATA - ['Authority' => {do_munging => 0}], + ['Authority' => {authority => $self->authority, do_munging => 0}], ['MetaJSON'], ['MetaYAML'], ['MetaNoIndex' => {directory => [@no_index]}], @@ -237,24 +283,26 @@ sub configure { # GENERATE FILES ['License'], - ['ReadmeAnyFromPod' => 'repo readme' => {filename => 'README.md', location => 'root', type => 'markdown'}], - ['ReadmeAnyFromPod' => 'dist readme' => {filename => 'README', location => 'build', type => 'text'}], - ['TravisYML'], + ['ReadmeAnyFromPod' => 'RepoReadme' => {filename => 'README.md', location => 'root', type => 'markdown', phase => 'release'}], + ['ReadmeAnyFromPod' => 'DistReadme' => {filename => 'README', location => 'build', type => 'text'}], + ['TravisYML' => {build_branch => '/^(dist|build\/.*)$/', perl_version => $perl_version, perl_version_build => $perl_version_build}], ['Manifest'], ['ManifestSkip'], $self->installer, # e.g. MakeMaker # RELEASE + ['NextRelease'], ['CheckChangesHasContent'], ['Git::Check' => {allow_dirty => [@allow_dirty], untracked_files => 'ignore'}], + ['RunExtraTests'], ['TestRelease'], # ['ConfirmRelease'], $self->no_upload ? ['FakeRelease'] : ['UploadToCPAN'], ['Git::Commit' => {allow_dirty => [@allow_dirty], commit_msg => 'Release %N %v%t%n%n%c'}], ['Git::CommitBuild' => {branch => '', release_branch => 'dist', release_message => 'Version %v%t'}], ['Git::Tag' => {tag_message => 'Version %v%t%n%n%c'}], - ['Git::Push' => {push_to => 'origin master +master:refs/heads/release +dist', remotes_must_exist => 0}], + $self->no_upload ? () : ['Git::Push' => {push_to => 'origin master +master:refs/heads/release +dist', remotes_must_exist => 0}], );