« lib/Dist/Zilla/Plugin/Author/GSG.pm
↑ Summary
lib/Dist/Zilla/Plugin/Author/GSG/HasVersionTests.pm »
| 1 | package Dist::Zilla::PluginBundle::Author::GSG; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | # ABSTRACT: Grant Street Group CPAN dists | ||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use version; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 2 | our $VERSION = 'v0.6.2'; # VERSION | |||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Git::Wrapper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 2 | with qw( | |||||||||||||||||||||||||||
| 12 | Dist::Zilla::Role::PluginBundle::Easy | ||||||||||||||||||||||||||||
| 13 | ); | ||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | #pod =for Pod::Coverage configure mvp_multivalue_args | ||||||||||||||||||||||||||||
| 17 | #pod | ||||||||||||||||||||||||||||
| 18 | #pod =cut | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 0 | ▶ | sub mvp_multivalue_args { qw( | ||||||||||||||||||||||||||
|
Subroutine
mvp_multivalue_args: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 21 | exclude_filename | ||||||||||||||||||||||||||||
| 22 | exclude_match | ||||||||||||||||||||||||||||
| 23 | test_compile_skip | ||||||||||||||||||||||||||||
| 24 | test_compile_file | ||||||||||||||||||||||||||||
| 25 | test_compile_module_finder | ||||||||||||||||||||||||||||
| 26 | test_compile_script_finder | ||||||||||||||||||||||||||||
| 27 | test_compile_switch | ||||||||||||||||||||||||||||
| 28 | dont_munge | ||||||||||||||||||||||||||||
| 29 | ) } | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 0 | ▶ | sub configure { | ||||||||||||||||||||||||||
|
Subroutine
configure: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 32 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | my $meta_provides | ||||||||||||||||||||||||||||
| 35 | 0 | ▶ | = 'MetaProvides::' . ( $self->payload->{meta_provides} || 'Package' ); | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->payload->{'meta_provides'} || 'Package'
MC/DC0%0/1
$self->payload->{'meta_provides'} || 'Package'
$self->payload->{'meta_provides'}
Truth table0%0/2
A
A= $self->payload->{'meta_provides'}
| |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 0 | $self->add_bundle( 'Filter' => { | |||||||||||||||||||||||||||
| 38 | -bundle => '@Basic', | ||||||||||||||||||||||||||||
| 39 | -remove => [ qw( | ||||||||||||||||||||||||||||
| 40 | UploadToCPAN | ||||||||||||||||||||||||||||
| 41 | GatherDir | ||||||||||||||||||||||||||||
| 42 | ) ] | ||||||||||||||||||||||||||||
| 43 | } ); | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | # We need to reconfigure the MakeMaker Plugin to require | ||||||||||||||||||||||||||||
| 46 | # a new enough version to support "version ranges". | ||||||||||||||||||||||||||||
| 47 | # https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/issues/215 | ||||||||||||||||||||||||||||
| 48 | my ($mm) | ||||||||||||||||||||||||||||
| 49 | 0 | = grep { $_->[1] eq 'Dist::Zilla::Plugin::MakeMaker' } | |||||||||||||||||||||||||||
| 50 | 0 | @{ $self->plugins }; | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | $mm->[2]->{eumm_version} = '7.1101'; | |||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 0 | my $name = $self->name; | |||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | $self->add_plugins( | ||||||||||||||||||||||||||||
| 57 | 'Author::GSG', | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | [ 'FileFinder::Filter' => 'MungeableFiles' => { | ||||||||||||||||||||||||||||
| 60 | finder => [ ':InstallModules', ':PerlExecFiles' ], | ||||||||||||||||||||||||||||
| 61 | 0 | %{ $self->config_slice({ dont_munge => 'skip' }) } | |||||||||||||||||||||||||||
| 62 | }], | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 'MetaJSON', | ||||||||||||||||||||||||||||
| 65 | [ 'OurPkgVersion' => { | ||||||||||||||||||||||||||||
| 66 | finder => [ "$name/MungeableFiles" ], | ||||||||||||||||||||||||||||
| 67 | semantic_version => 1, | ||||||||||||||||||||||||||||
| 68 | overwrite => 1, | ||||||||||||||||||||||||||||
| 69 | } ], | ||||||||||||||||||||||||||||
| 70 | 'Prereqs::FromCPANfile', | ||||||||||||||||||||||||||||
| 71 | $meta_provides, | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | [ 'StaticInstall' => $self->config_slice( { | ||||||||||||||||||||||||||||
| 74 | static_install_mode => 'mode', | ||||||||||||||||||||||||||||
| 75 | static_install_dry_run => 'dry_run', | ||||||||||||||||||||||||||||
| 76 | } ) ], | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | # StaticInstall wants scripts in a script/ ExecDir | ||||||||||||||||||||||||||||
| 79 | [ 'ExecDir' => { dir => 'script' } ], | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | [ 'PodWeaver' => { | ||||||||||||||||||||||||||||
| 82 | finder => [ "$name/MungeableFiles" ], | ||||||||||||||||||||||||||||
| 83 | replacer => 'replace_with_comment', | ||||||||||||||||||||||||||||
| 84 | post_code_replacer => 'replace_with_nothing', | ||||||||||||||||||||||||||||
| 85 | config_plugin => [ '@Default', 'Contributors' ] | ||||||||||||||||||||||||||||
| 86 | } ], | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 'ReadmeAnyFromPod', | ||||||||||||||||||||||||||||
| 89 | [ 'ChangelogFromGit::CPAN::Changes' => { | ||||||||||||||||||||||||||||
| 90 | file_name => 'CHANGES', | ||||||||||||||||||||||||||||
| 91 | # Support both old 0.90 versioning and new v1.2.3 semantic versioning formats | ||||||||||||||||||||||||||||
| 92 | tag_regexp => '\b(v?\d+\.\d+(?:\.\d+)*)\b', | ||||||||||||||||||||||||||||
| 93 | copy_to_root => 0, | ||||||||||||||||||||||||||||
| 94 | } ], | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | [ 'Author::GSG::Git::NextVersion' => { | ||||||||||||||||||||||||||||
| 97 | first_version => 'v0.0.1', | ||||||||||||||||||||||||||||
| 98 | version_regexp => '\b(v\d+\.\d+\.\d+)\b', | ||||||||||||||||||||||||||||
| 99 | } ], | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 'Git::Commit', | ||||||||||||||||||||||||||||
| 102 | 'Git::Tag', | ||||||||||||||||||||||||||||
| 103 | 'Git::Push', | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | [ 'Git::GatherDir' => $self->config_slice( qw< | ||||||||||||||||||||||||||||
| 106 | exclude_filename | ||||||||||||||||||||||||||||
| 107 | exclude_match | ||||||||||||||||||||||||||||
| 108 | include_dotfiles | ||||||||||||||||||||||||||||
| 109 | > ) ], | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 'GitHub::Meta', | ||||||||||||||||||||||||||||
| 112 | 'Author::GSG::GitHub::UploadRelease', | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | [ 'Test::Compile' => $self->config_slice( { | ||||||||||||||||||||||||||||
| 115 | 0 | map {; "test_compile_$_" => $_ } qw< | |||||||||||||||||||||||||||
| 116 | filename | ||||||||||||||||||||||||||||
| 117 | phase | ||||||||||||||||||||||||||||
| 118 | skip | ||||||||||||||||||||||||||||
| 119 | file | ||||||||||||||||||||||||||||
| 120 | fake_home | ||||||||||||||||||||||||||||
| 121 | needs_display | ||||||||||||||||||||||||||||
| 122 | fail_on_warning | ||||||||||||||||||||||||||||
| 123 | bail_out_on_fail | ||||||||||||||||||||||||||||
| 124 | module_finder | ||||||||||||||||||||||||||||
| 125 | script_finder | ||||||||||||||||||||||||||||
| 126 | xt_mode | ||||||||||||||||||||||||||||
| 127 | switch | ||||||||||||||||||||||||||||
| 128 | > | ||||||||||||||||||||||||||||
| 129 | } ) ], | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 'Test::ReportPrereqs', | ||||||||||||||||||||||||||||
| 132 | 'Author::GSG::HasVersionTests', | ||||||||||||||||||||||||||||
| 133 | 'PodSyntaxTests', | ||||||||||||||||||||||||||||
| 134 | 'PodCoverageTests', | ||||||||||||||||||||||||||||
| 135 | ); | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | my ($gather_dir) | ||||||||||||||||||||||||||||
| 138 | 0 | = grep { $_->[1] eq 'Dist::Zilla::Plugin::Git::GatherDir' } | |||||||||||||||||||||||||||
| 139 | 0 | @{ $self->plugins }; | |||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | 0 | push @{ $gather_dir->[2]->{exclude_filename} }, | |||||||||||||||||||||||||||
| 142 | qw< README.md LICENSE.txt >; | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | # By default we want to set the github remote, | ||||||||||||||||||||||||||||
| 145 | # but "subclasses" may not want that, so make them | ||||||||||||||||||||||||||||
| 146 | # calculate the github_remote themselves. | ||||||||||||||||||||||||||||
| 147 | $self->payload->{find_github_remote} //= | ||||||||||||||||||||||||||||
| 148 | 0 | ▶ | $self->name eq '@Author::GSG'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->payload->{"find_github_remote"} //= $self->name eq "\@Author::GSG"
MC/DC0%0/1
$self->payload->{"find_github_remote"} //= $self->name eq "\@Author::GSG"
$self->payload->{"find_github_remote"}
Truth table0%0/2
A
A= $self->payload->{"find_github_remote"}
| |||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | # Look for the GitHub remote, or fail, if we are supposed to. | ||||||||||||||||||||||||||||
| 151 | 0 | ▶ | if ( $self->payload->{find_github_remote} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 152 | 0 | ▶ | $self->payload->{github_remote} //= $self->_find_github_remote | ||||||||||||||||||||||||||
|
Condition0%0/4
$self->payload->{"github_remote"} //= $self->_find_github_remote // croak("Unable to find git remote for GitHub")
$self->_find_github_remote // croak("Unable to find git remote for GitHub")
MC/DC0%0/1
$self->payload->{"github_remote"} //= $self->_find_github_remote // croak("Unable to find git remote for GitHub")
$self->payload->{"github_remote"}
Truth table0%0/2
A
A= $self->payload->{"github_remote"}
| |||||||||||||||||||||||||||||
| 153 | // croak "Unable to find git remote for GitHub"; | ||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | $self->_set_github_remote( $self->payload->{github_remote} ) | ||||||||||||||||||||||||||||
| 157 | if defined $self->payload->{github_remote} | ||||||||||||||||||||||||||||
| 158 | 0 | ▶ | and length $self->payload->{github_remote}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $self->payload->{"github_remote"} and length $self->payload->{"github_remote"}
MC/DC0%0/2
defined $self->payload->{"github_remote"} and length $self->payload->{"github_remote"}
defined $self->payload->{"github_remote"}
length $self->payload->{"github_remote"}
Truth table0%0/3
A and B
A= defined $self->payload->{"github_remote"}B= length $self->payload->{"github_remote"}
| |||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | 0 | ▶ | sub _set_github_remote { | ||||||||||||||||||||||||||
|
Subroutine
_set_github_remote: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||
| 163 | 0 | my ( $self, $remote ) = @_; | |||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | 0 | my @git; | |||||||||||||||||||||||||||
| 166 | my @github; | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | 0 | foreach my $plugin ( @{ $self->plugins } ) { | |||||||||||||||||||||||||||
| 169 | 0 | ▶ | if ( $plugin->[1] =~ /GitHub/ ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 170 | 0 | push @github, $plugin; | |||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||
| 172 | elsif ( $plugin->[1] =~ /Git/ ) { | ||||||||||||||||||||||||||||
| 173 | 0 | push @git, $plugin; | |||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | # All our git/github plugins configure this way, so good enough? | ||||||||||||||||||||||||||||
| 178 | 0 | $_->[2]->{push_to} = [$remote] for @git; | |||||||||||||||||||||||||||
| 179 | 0 | $_->[2]->{remote} = $remote for @github; | |||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | 0 | return $remote; | |||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 0 | ▶ | sub _find_github_remote { | ||||||||||||||||||||||||||
|
Subroutine
_find_github_remote: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||
| 185 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | # If it's a git issue finding the remote, | ||||||||||||||||||||||||||||
| 188 | # the user can figure it out. | ||||||||||||||||||||||||||||
| 189 | 0 | my @remotes = do { local $@; eval { local $SIG{__DIE__}; | |||||||||||||||||||||||||||
| 190 | 0 | Git::Wrapper->new('.')->remote('-v') } }; | |||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | 0 | my $remote; | |||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | 0 | for (@remotes) { | |||||||||||||||||||||||||||
| 195 | 0 | my ( $name, $url, $direction ) | |||||||||||||||||||||||||||
| 196 | = /^ (\P{PosixCntrl}+) \s+ (.*) \s+ \( ([^)]+) \) $/x; | ||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | 0 | ▶ | next unless ( $direction || '' ) eq 'push'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$direction || ''
MC/DC0%0/1
$direction || ''
$direction
Truth table0%0/2
A
A= $direction
| |||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | 0 | ▶ | if ( $url | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 201 | =~ m{(?: :// | \@ ) (?: [\w\-\.]+\. )? github\.com [/:] }ix ) | ||||||||||||||||||||||||||||
| 202 | { | ||||||||||||||||||||||||||||
| 203 | 0 | ▶ | croak "Multiple git remotes found for GitHub" if defined $remote; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 204 | 0 | $remote = $name; | |||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | 0 | return $remote; | |||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | 2 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | package # hide from the CPAN | ||||||||||||||||||||||||||||
| 215 | Dist::Zilla::Plugin::Author::GSG::GitHub::UploadRelease; | ||||||||||||||||||||||||||||
| 216 | 2 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 217 | 2 | ▶ | BEGIN { extends 'Dist::Zilla::Plugin::GitHub::UploadRelease' } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 218 | 2 | with qw( | |||||||||||||||||||||||||||
| 219 | Dist::Zilla::Role::Releaser | ||||||||||||||||||||||||||||
| 220 | ); | ||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | 0 | ▶ | sub release {1} # do nothing, just let the GitHub Uploader do it for us | ||||||||||||||||||||||||||
|
Subroutine
release: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | # TODO: on release, regen README.md in src dir | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | 0 | ▶ | around 'after_release' => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 227 | 0 | my ($orig, $self, @args) = @_; | |||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | 0 | ▶ | my $git_tag_plugin = $self->zilla->plugin_named('@Author::GSG/Git::Tag') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 230 | or $self->log_fatal('Plugin @Author::GSG/Git::Tag not found!'); | ||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | # GitHub::UploadRelease looks for the Git::Tag Plugin with this name | ||||||||||||||||||||||||||||
| 233 | 0 | local $git_tag_plugin->{plugin_name} = 'Git::Tag'; | |||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | 0 | return $self->$orig(@args); | |||||||||||||||||||||||||||
| 236 | 2 | }; | |||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | 0 | ▶ | sub _get_credentials { | ||||||||||||||||||||||||||
|
Subroutine
_get_credentials: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 239 | 0 | my ($self, $login_only) = @_; | |||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | 0 | my $creds = $self->_credentials; | |||||||||||||||||||||||||||
| 242 | # return $creds->{login} if $login_only; | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | 0 | my $otp; | |||||||||||||||||||||||||||
| 245 | 0 | ▶ | $otp = $self->zilla->chrome->prompt_str( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 246 | "GitHub two-factor authentication code for '$creds->{login}'", | ||||||||||||||||||||||||||||
| 247 | { noecho => 1 }, | ||||||||||||||||||||||||||||
| 248 | ) if $self->prompt_2fa; | ||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | 0 | return ( $creds->{login}, $creds->{pass}, $otp ); | |||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | 2 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | package # hide from the CPAN | ||||||||||||||||||||||||||||
| 256 | Dist::Zilla::Plugin::Author::GSG::Git::NextVersion; | ||||||||||||||||||||||||||||
| 257 | 2 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 258 | 2 | ▶ | BEGIN { extends 'Dist::Zilla::Plugin::Git::NextVersion' } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | 0 | ▶ | before 'provide_version' => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 261 | 0 | ▶ | if ( my $v = $ENV{V} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 262 | 0 | $v =~ s/^v//; | |||||||||||||||||||||||||||
| 263 | 0 | my @v = split /\./, $v; | |||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | 0 | ▶ | Carp::croak "Invalid version '$ENV{V}' in \$ENV{V}" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@v > 3 or grep /\D/, @v
MC/DC0%0/2
@v > 3 or grep /\D/, @v
@v > 3
grep /\D/, @v
Truth table0%0/3
A or B
A= @v > 3B= grep /\D/, @v
| |||||||||||||||||||||||||||||
| 266 | if @v > 3 or grep /\D/, @v; | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | # perl v5.22+ complain about too many arguments to printf | ||||||||||||||||||||||||||||
| 269 | 0 | $ENV{V} = sprintf "v%d.%d.%d", (@v, 0, 0, 0)[0..2]; | |||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||
| 271 | 2 | }; | |||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | 2 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | 2 | 1; | |||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | __END__ | ||||||||||||||||||||||||||||