Dist-Zilla-PluginBundle-Codeberg
view release on metacpan or search on metacpan
lib/Dist/Zilla/App/Command/codeberg.pm view on Meta::CPAN
package Dist::Zilla::App::Command::codeberg 2.0100;
use Modern::Perl;
use Cwd qw(cwd);
use Dist::Zilla::App -command;
our $AUTHORITY = 'cpan:GEEKRUTH'; # AUTHORITY
## no critic qw(ProhibitAmbiguousNames)
sub abstract {'use the Codeberg plugins from the command-line'}
sub description {'Use the Codeberg plugins from the command-line'}
sub usage_desc {'%c %o [ update | create [<repository>] ]'}
## no critic qw(ProhibitCommaSeparatedStatements)
sub opt_spec {
[
'profile|p=s', 'name of the profile to use',
{ default => 'default' }
],
[
'provider|P=s', 'name of the profile provider to use',
{ default => 'Default' }
],
;
}
## use critic
sub execute {
my ( $self, $opt, $arg ) = @_;
my $zilla = $self->zilla;
$_->gather_files
for eval { Dist::Zilla::App->VERSION('7.000') }
? $zilla->plugins_with( -FileGatherer )
: @{ $zilla->plugins_with( -FileGatherer ) };
if ( $arg->[0] eq 'create' ) {
require Dist::Zilla::Dist::Minter;
my $minter = Dist::Zilla::Dist::Minter->_new_from_profile(
[ $opt->provider, $opt->profile ], {
chrome => $self->app->chrome,
name => $zilla->name,
},
);
my $create = _find_plug( $minter, 'Codeberg::Create' );
my $root = cwd();
my $repo = $arg->[1];
$create->after_mint(
{
mint_root => $root,
repo => $repo,
description => $zilla->abstract
}
);
}
elsif ( $arg->[0] eq 'update' ) {
_find_plug( $zilla, 'Codeberg::Update' )->after_release;
}
}
sub _find_plug {
( run in 2.226 seconds using v1.01-cache-2.11-cpan-c966e8aa7e8 )