Dist-Zilla-PluginBundle-GitLab

 view release on metacpan or  search on metacpan

lib/Dist/Zilla/App/Command/gl.pm  view on Meta::CPAN

package Dist::Zilla::App::Command::gl 1.0002;

use Modern::Perl;
use Cwd qw(cwd);
use Dist::Zilla::App -command;

## no critic qw(ProhibitAmbiguousNames)
sub abstract    {'use the GitLab plugins from the command-line'}
sub description {'Use the GitLab 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, 'GitLab::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, 'GitLab::Update' )->after_release;
   }
}

sub _find_plug {
   my ( $self, $name ) = @_;

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

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