X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=lib%2FDist%2FZilla%2FPluginBundle%2FAuthor%2FCCM.pm;fp=lib%2FDist%2FZilla%2FPluginBundle%2FAuthor%2FCCM.pm;h=0b92f3020131fe49ff3da03a6d81ad145042f4ee;hb=166216d7c076ef2eb8ca60d92103d0b1a22afaea;hp=5105692ea75cc82f5eeb77ae9fda5a151b414fab;hpb=01e06cb9c2ec2cf35841350ea042eeaf0df8008e;p=chaz%2Fp5-Dist-Zilla-PluginBundle-Author-CCM diff --git a/lib/Dist/Zilla/PluginBundle/Author/CCM.pm b/lib/Dist/Zilla/PluginBundle/Author/CCM.pm index 5105692..0b92f30 100644 --- a/lib/Dist/Zilla/PluginBundle/Author/CCM.pm +++ b/lib/Dist/Zilla/PluginBundle/Author/CCM.pm @@ -7,13 +7,25 @@ use 5.014; use warnings; use strict; -our $VERSION = '0.007'; # VERSION +our $VERSION = '0.008'; # VERSION use Dist::Zilla::Util; use Moose; +use Perl::Version; use namespace::autoclean; +has max_target_perl => ( + is => 'ro', + isa => 'Str', + lazy => 1, + default => sub { + my $self = shift; + $self->payload->{'Test::MinimumVersion.max_target_perl'} // $self->payload->{max_target_perl} // '5.10.1'; + }, +); + + has authority => ( is => 'ro', isa => 'Str', @@ -29,7 +41,7 @@ has installer => ( is => 'ro', isa => 'Str', lazy => 1, - default => sub { shift->payload->{installer} || 'MakeMaker' }, + default => sub { shift->payload->{installer} // 'MakeMaker' }, ); @@ -60,9 +72,8 @@ sub configure { 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'; + my $perl_version_target = $self->max_target_perl; + my ($perl_version, $perl_version_build) = $self->_travis_perl_versions($perl_version_target); if ($self->no_upload) { say '[@Author::CCM] WARNING! WARNING! WARNING! *** You are in no_upload mode!! ***'; @@ -174,6 +185,29 @@ sub configure { $self->add_plugins(@plugins); } +sub _travis_perl_versions { + my $self = shift; + + my $perl_version_target = Perl::Version->new(shift or die 'Missing target version'); + my $min_version = Perl::Version->new('5.14'); + my $min_version_build = Perl::Version->new($perl_version_target); + $min_version_build->subversion(0); + + my @versions; + my @versions_build; + + for my $v (qw{5.26 5.24 5.22 5.20 5.18 5.16 5.14 5.12 5.10 5.8}) { + my $version = Perl::Version->new($v); + push @versions, "$version" if $version >= $min_version_build && $version >= $min_version; + push @versions_build, "$version" if $version >= $min_version_build; + } + + my $perl_version = join(' ', @versions); + my $perl_version_build = join(' ', @versions_build); + + return ($perl_version, $perl_version_build); +} + with 'Dist::Zilla::Role::PluginBundle::Easy'; with 'Dist::Zilla::Role::PluginBundle::PluginRemover'; with 'Dist::Zilla::Role::PluginBundle::Config::Slicer'; @@ -193,7 +227,7 @@ Dist::Zilla::PluginBundle::Author::CCM - A plugin bundle for distributions built =head1 VERSION -version 0.007 +version 0.008 =head1 SYNOPSIS @@ -305,6 +339,10 @@ You probably don't want to use this. =head1 ATTRIBUTES +=head2 max_target_perl + +Specify the minimum perl version. Defaults to C<5.10.1>. + =head2 authority Specify the release authority. Defaults to C.