Dist-Zilla-Plugin-Upload-OrePAN2

 view release on metacpan or  search on metacpan

lib/Dist/Zilla/Plugin/Upload/OrePAN2.pm  view on Meta::CPAN

package Dist::Zilla::Plugin::Upload::OrePAN2;
use Modern::Perl;
our $VERSION = '0.0001'; # VERSION
our $AUTHORITY = 'cpan:GEEKRUTH'; # AUTHORITY
# ABSTRACT: Dist::Zilla release plugin to inject into a local OrePAN2 repository
use Carp;

use Moose;
use MooseX::Types::Moose qw/Str Bool/;
use MooseX::Types::Path::Tiny qw/AbsPath/;
use OrePAN2;
use OrePAN2::CLI::Indexer;
use OrePAN2::Injector;
use Path::Tiny;

use namespace::autoclean;

with 'Dist::Zilla::Role::Releaser';

has clobber => (
    is      => 'ro',
    isa     => Bool,
    default => 0,
);

has directory => (
    is       => 'ro',
    isa      => AbsPath,
    coerce   => 1,
    required => 1,
);

has username => (
  is   => 'ro',
  isa  => 'Str',
  default => 'DUMMY',
);

sub release {
    my ( $self, $archive ) = @_;
    if (path($self->directory)->is_relative ) {
        $self->log_fatal('The directory path appears to be relative. It must be absolute.  Halting!');
    }

    my $dest = $self->directory->child( $archive->basename );
    my $upload_name = $dest;

    if ( $dest->is_file && !$self->clobber ) {
        $self->log_fatal("dest file $dest exists.  Halting!");
    }

    my $injector = OrePAN2::Injector->new(directory => $self->directory, author => $self->username );
    $injector->inject( $archive )
      or $self->log_fatal( "Error uploading: $!" );

    $self->log( "$archive uploaded to $dest.");

    OrePAN2::CLI::Indexer->new()->run($self->directory);

    return;
}

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.260 second using v1.00-cache-2.02-grep-82fe00e-cpan-f5108d614456 )