Dist-Zilla-Plugin-NexusRelease

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

Revision history for Dist-Zilla-Plugin-NexusRelease

1.0.1     2016-09-27 01:07:28+01:00 Europe/Dublin

 - Move credentials out to a Stash rather than dist.ini

1.0.0     2016-09-26 23:51:30+01:00 Europe/Dublin

 - Remove the 'repository' attribute and use 'nexus_URL' as the entire URL to a repo.
 - Depend on Nexus::Uploader 1.0.0 or newer.

0.0.3     2016-09-26 22:25:59+01:00 Europe/Dublin

 - Using MetaProvides::Package to index the main module.

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

    # Nexus::Uploader will be loaded later if used
    our @ISA = 'Nexus::Uploader';

    sub log {
        my $self = shift;
        $self->{'Dist::Zilla'}{plugin}->log(@_);
    }
}


has credentials_stash => (
    is      => 'ro',
    isa     => 'Str',
    default => '%Nexus'
);

has _credentials_stash_obj => (
    is       => 'ro',
    isa      => maybe_type( class_type('Dist::Zilla::Stash::Nexus') ),
    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;
}


has username => (
    is       => 'ro',
    isa      => 'Str',
    required => 1,
    lazy     => 1,
    default  => sub {

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

      group      = Nexus group ID to use for the upload

The following are optional but very likely to be used:

      nexus_URL  = Nexus repository URL

The Nexus Artefact is set to the Perl distribution name (C<name> in F<dist.ini>, and the version is set to the Perl distribution version.

=head1 ATTRIBUTES

=head2 credentials_stash

This attribute holds the name of a L<Nexus stash|Dist::Zilla::Stash::Nexus>
that will contain the credentials to be used for the upload.  By default,
NexusRelease will look for a C<%Nexus> stash.

=head2 username

This is the Nexus user to log in with.

User will be prompted if this is not set in the C<%Nexus> stash.

=head2 password

lib/Dist/Zilla/Stash/Nexus.pm  view on Meta::CPAN

use strict;
use warnings;

package Dist::Zilla::Stash::Nexus;
$Dist::Zilla::Stash::Nexus::VERSION = '1.0.1';
# ABSTRACT: a stash of your Nexus credentials

use Moose;

use namespace::autoclean;


has username => (
    is       => 'ro',
    isa      => 'Str',
    required => 1,

lib/Dist/Zilla/Stash/Nexus.pm  view on Meta::CPAN

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Dist::Zilla::Stash::Nexus - a stash of your Nexus credentials

=head1 VERSION

version 1.0.1

=head1 OVERVIEW

The Nexus stash is a L<Login|Dist::Zilla::Role::Stash::Login> stash used for uploading to Sonatype Nexus.

=head1 AUTHOR

t/nexusrelease.t  view on Meta::CPAN

# No config at all:
{
    my $tzil = build_tzil( 'NexusRelease', 'FakeRelease', );

    # Pretend user just hits Enter at the prompts:
    set_responses( $tzil, '', '', '' );

    like(
        exception { $tzil->release },
        qr/Missing attributes/,
        "release without credentials fails"
    );

    my $msgs = $tzil->log_messages;

    #ok( 0, "Log messages (No config): " . join( "\n", @$msgs ) );

    ok( grep( {/You need to supply a username/} @$msgs ),
        "insist on username" );
    ok( !grep( {/Uploading.*DZT-Sample/} @$msgs ),
        "no upload without credentials" );
    ok( !grep( {/fake release happen/i} @$msgs ),
        "no release without credentials"
    );
}

#---------------------------------------------------------------------
# No config at all, but enter username:
{
    my $tzil = build_tzil( 'NexusRelease', 'FakeRelease' );

    # Pretend user just hits Enter at the password prompt:
    set_responses( $tzil, 'user', '', 'BRAD' );



( run in 0.249 second using v1.01-cache-2.11-cpan-4d50c553e7e )