| 1 | package Dist::Zilla::Plugin::Upload::OrePAN2; | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use Modern::Perl; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | our $VERSION = '0.0001'; # VERSION | |||||||||||||||||||||||||||
| 4 | 1 | our $AUTHORITY = 'cpan:GEEKRUTH'; # AUTHORITY | |||||||||||||||||||||||||||
| 5 | # ABSTRACT: Dist::Zilla release plugin to inject into a local OrePAN2 repository | ||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use MooseX::Types::Moose qw/Str Bool/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use MooseX::Types::Path::Tiny qw/AbsPath/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use OrePAN2; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use OrePAN2::CLI::Indexer; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use OrePAN2::Injector; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use Path::Tiny; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 1 | with 'Dist::Zilla::Role::Releaser'; | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 1 | has clobber => ( | |||||||||||||||||||||||||||
| 21 | is => 'ro', | ||||||||||||||||||||||||||||
| 22 | isa => Bool, | ||||||||||||||||||||||||||||
| 23 | default => 0, | ||||||||||||||||||||||||||||
| 24 | ); | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 1 | has directory => ( | |||||||||||||||||||||||||||
| 27 | is => 'ro', | ||||||||||||||||||||||||||||
| 28 | isa => AbsPath, | ||||||||||||||||||||||||||||
| 29 | coerce => 1, | ||||||||||||||||||||||||||||
| 30 | required => 1, | ||||||||||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 1 | has username => ( | |||||||||||||||||||||||||||
| 34 | is => 'ro', | ||||||||||||||||||||||||||||
| 35 | isa => 'Str', | ||||||||||||||||||||||||||||
| 36 | default => 'DUMMY', | ||||||||||||||||||||||||||||
| 37 | ); | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 0 | ▶ | sub release { | ||||||||||||||||||||||||||
|
Subroutine
release: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 40 | 0 | my ( $self, $archive ) = @_; | |||||||||||||||||||||||||||
| 41 | 0 | ▶ | if (path($self->directory)->is_relative ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | 0 | $self->log_fatal('The directory path appears to be relative. It must be absolute. Halting!'); | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 0 | my $dest = $self->directory->child( $archive->basename ); | |||||||||||||||||||||||||||
| 46 | 0 | my $upload_name = $dest; | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | if ( $dest->is_file && !$self->clobber ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$dest->is_file and not $self->clobber
MC/DC0%0/2
$dest->is_file and not $self->clobber
$dest->is_file
not $self->clobber
Truth table0%0/3
A and not(B)
A= $dest->is_fileB= not $self->clobber
| |||||||||||||||||||||||||||||
| 49 | 0 | $self->log_fatal("dest file $dest exists. Halting!"); | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | my $injector = OrePAN2::Injector->new(directory => $self->directory, author => $self->username ); | |||||||||||||||||||||||||||
| 53 | 0 | ▶ | $injector->inject( $archive ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | or $self->log_fatal( "Error uploading: $!" ); | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 0 | $self->log( "$archive uploaded to $dest."); | |||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | OrePAN2::CLI::Indexer->new()->run($self->directory); | |||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 0 | return; | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 1 | 1; | |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | __END__ | ||||||||||||||||||||||||||||