Dist-Zilla-PluginBundle-Author-GSG
view release on metacpan or search on metacpan
lib/Dist/Zilla/PluginBundle/Author/GSG.pm view on Meta::CPAN
$_->[2]->{push_to} = [$remote] for @git;
$_->[2]->{remote} = $remote for @github;
return $remote;
}
sub _find_github_remote {
my ($self) = @_;
# If it's a git issue finding the remote,
# the user can figure it out.
my @remotes = do { local $@; eval { local $SIG{__DIE__};
Git::Wrapper->new('.')->remote('-v') } };
my $remote;
for (@remotes) {
my ( $name, $url, $direction )
= /^ (\P{PosixCntrl}+) \s+ (.*) \s+ \( ([^)]+) \) $/x;
next unless ( $direction || '' ) eq 'push';
if ( $url
=~ m{(?: :// | \@ ) (?: [\w\-\.]+\. )? github\.com [/:] }ix )
{
croak "Multiple git remotes found for GitHub" if defined $remote;
$remote = $name;
}
}
return $remote;
}
__PACKAGE__->meta->make_immutable;
package # hide from the CPAN
Dist::Zilla::Plugin::Author::GSG::GitHub::UploadRelease;
use Moose;
BEGIN { extends 'Dist::Zilla::Plugin::GitHub::UploadRelease' }
with qw(
Dist::Zilla::Role::Releaser
);
sub release {1} # do nothing, just let the GitHub Uploader do it for us
# TODO: on release, regen README.md in src dir
around 'after_release' => sub {
my ($orig, $self, @args) = @_;
my $git_tag_plugin = $self->zilla->plugin_named('@Author::GSG/Git::Tag')
or $self->log_fatal('Plugin @Author::GSG/Git::Tag not found!');
# GitHub::UploadRelease looks for the Git::Tag Plugin with this name
local $git_tag_plugin->{plugin_name} = 'Git::Tag';
return $self->$orig(@args);
};
sub _get_credentials {
my ($self, $login_only) = @_;
my $creds = $self->_credentials;
# return $creds->{login} if $login_only;
my $otp;
$otp = $self->zilla->chrome->prompt_str(
"GitHub two-factor authentication code for '$creds->{login}'",
{ noecho => 1 },
) if $self->prompt_2fa;
return ( $creds->{login}, $creds->{pass}, $otp );
}
__PACKAGE__->meta->make_immutable;
package # hide from the CPAN
Dist::Zilla::Plugin::Author::GSG::Git::NextVersion;
use Moose;
BEGIN { extends 'Dist::Zilla::Plugin::Git::NextVersion' }
before 'provide_version' => sub {
if ( my $v = $ENV{V} ) {
$v =~ s/^v//;
my @v = split /\./, $v;
Carp::croak "Invalid version '$ENV{V}' in \$ENV{V}"
if @v > 3 or grep /\D/, @v;
# perl v5.22+ complain about too many arguments to printf
$ENV{V} = sprintf "v%d.%d.%d", (@v, 0, 0, 0)[0..2];
}
};
__PACKAGE__->meta->make_immutable;
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Dist::Zilla::PluginBundle::Author::GSG - Grant Street Group CPAN dists
=head1 VERSION
version v0.6.2
=head1 SYNOPSIS
Your C<dist.ini> can be as short as this:
name = Foo-Bar-GSG
[@Author::GSG]
Which is equivalent to all of this:
Some of which comes from L<Dist::Zilla::Plugin::Author::GSG>.
( run in 0.823 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )