| 1 | 1 | ▶ | use 5.010001; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | package Dist::Inkt::Role::Release; | ||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 1 | our $AUTHORITY = 'cpan:TOBYINK'; | |||||||||||||||||||
| 8 | 1 | our $VERSION = '0.004'; | |||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | 1 | ▶ | use Moose::Role; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 1 | ▶ | use Types::Standard -types; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | 1 | ▶ | use namespace::autoclean; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 1 | has should_release_on_build => ( is => "ro", isa => Bool, default => 0, init_arg => "should_release" ); | |||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 1 | for my $category (qw( prerelease_action postrelease_action )) | |||||||||||||||||||
| 17 | { | ||||||||||||||||||||
| 18 | has "${category}s" => ( | ||||||||||||||||||||
| 19 | traits => ["Array"], | ||||||||||||||||||||
| 20 | is => "ro", | ||||||||||||||||||||
| 21 | isa => ArrayRef[CodeRef], | ||||||||||||||||||||
| 22 | 0 | ▶ | default => sub { [] }, | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 23 | 2 | handles => { "setup_${category}" => "push" }, | |||||||||||||||||||
| 24 | init_arg => undef, | ||||||||||||||||||||
| 25 | lazy => 1, | ||||||||||||||||||||
| 26 | ); | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 2 | has "skip_${category}s" => ( | |||||||||||||||||||
| 29 | is => "ro", | ||||||||||||||||||||
| 30 | isa => Bool, | ||||||||||||||||||||
| 31 | default => 0, | ||||||||||||||||||||
| 32 | ); | ||||||||||||||||||||
| 33 | } | ||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | my $_run = sub | ||||||||||||||||||||
| 36 | 0 | ▶ | { | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||
| 37 | 0 | my $self = shift; | |||||||||||||||||||
| 38 | 0 | my $type = $_[0] . "s"; | |||||||||||||||||||
| 39 | 0 | (my $label = $type) =~ s/_/ /g; | |||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | 0 | ▶ | return unless @{$self->$type}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 42 | 0 | ▶ | return $self->log("Skipping $label") if $self->${\ "skip_$type" }; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 43 | 0 | $self->log("Running $label..."); | |||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 0 | for my $test (@{ $self->$type }) | |||||||||||||||||||
| 46 | { | ||||||||||||||||||||
| 47 | 0 | $self->$test(); | |||||||||||||||||||
| 48 | } | ||||||||||||||||||||
| 49 | 1 | }; | |||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | sub Release | ||||||||||||||||||||
| 52 | 0 | ▶ | { | ||||||||||||||||||
|
Subroutine
Release: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||
| 53 | 0 | my $self = shift; | |||||||||||||||||||
| 54 | 0 | ▶ | my $file = Path::Tiny::path($_[0] || sprintf('%s.tar.gz', $self->targetdir)); | ||||||||||||||||||
|
Condition0%0/3
$_[0] || sprintf('%s.tar.gz', $self->targetdir)
MC/DC0%0/2
$_[0] || sprintf('%s.tar.gz', $self->targetdir)
$_[0]
sprintf('%s.tar.gz', $self->targetdir)
Truth table0%0/3
A || B
A= $_[0]B= sprintf('%s.tar.gz', $self->targetdir)
| |||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | 0 | ▶ | -f $file or $self->BuildTarball($_[0]); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | 0 | $self->$_run("prerelease_action"); | |||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | 0 | ▶ | if (system("cpan-upload", $file)) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 61 | { | ||||||||||||||||||||
| 62 | 0 | $self->log("Could not upload to CPAN!"); | |||||||||||||||||||
| 63 | 0 | die("cpan-upload failed; stopping"); | |||||||||||||||||||
| 64 | } | ||||||||||||||||||||
| 65 | |||||||||||||||||||||
| 66 | 0 | $self->$_run("postrelease_action"); | |||||||||||||||||||
| 67 | } | ||||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | 0 | ▶ | after BuildAll => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||
| 70 | 0 | my $self = shift; | |||||||||||||||||||
| 71 | 0 | ▶ | $self->Release if $self->should_release_on_build; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 72 | 1 | }; | |||||||||||||||||||
| 73 | |||||||||||||||||||||
| 74 | 1 | 1; | |||||||||||||||||||
| 75 | |||||||||||||||||||||
| 76 | __END__ | ||||||||||||||||||||