Dist-Zilla-Plugin-UploadToCPAN-WWWPAUSESimple
view release on metacpan or search on metacpan
lib/Dist/Zilla/Plugin/UploadToCPAN/WWWPAUSESimple.pm view on Meta::CPAN
package Dist::Zilla::Plugin::UploadToCPAN::WWWPAUSESimple;
our $DATE = '2017-01-12'; # DATE
our $VERSION = '0.04'; # VERSION
use Moose;
with qw(Dist::Zilla::Role::BeforeRelease Dist::Zilla::Role::Releaser);
use File::Spec;
use Moose::Util::TypeConstraints;
use Scalar::Util qw(weaken);
use Try::Tiny;
use namespace::autoclean;
has credentials_stash => (
is => 'ro',
isa => 'Str',
default => '%PAUSE'
);
has _credentials_stash_obj => (
is => 'ro',
isa => maybe_type( class_type('Dist::Zilla::Stash::PAUSE') ),
lazy => 1,
init_arg => undef,
default => sub { $_[0]->zilla->stash_named( $_[0]->credentials_stash ) },
);
sub _credential {
my ($self, $name) = @_;
return unless my $stash = $self->_credentials_stash_obj;
return $stash->$name;
}
sub mvp_aliases {
return { user => 'username' };
}
has username => (
is => 'ro',
isa => 'Str',
lazy => 1,
required => 1,
default => sub {
my ($self) = @_;
return $self->_credential('username')
|| $self->pause_cfg->{user}
|| $self->zilla->chrome->prompt_str("PAUSE username: ");
},
);
has password => (
is => 'ro',
isa => 'Str',
lazy => 1,
required => 1,
default => sub {
my ($self) = @_;
return $self->_credential('password')
|| $self->pause_cfg->{password}
|| $self->zilla->chrome->prompt_str('PAUSE password: ', { noecho => 1 });
},
);
has pause_cfg_file => (
is => 'ro',
isa => 'Str',
lazy => 1,
default => sub { '.pause' },
);
has pause_cfg_dir => (
is => 'ro',
isa => 'Str',
lazy => 1,
default => sub { require File::HomeDir; File::HomeDir::->my_home },
);
has pause_cfg => (
is => 'ro',
isa => 'HashRef[Str]',
lazy => 1,
default => sub {},
);
has subdir => (
is => 'ro',
isa => 'Str',
predicate => 'has_subdir',
);
( run in 0.596 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )