Dist-Zilla-PluginBundle-Author-Plicease

 view release on metacpan or  search on metacpan

lib/Dist/Zilla/Plugin/Author/Plicease/ReadmeAnyFromPod.pm  view on Meta::CPAN

package Dist::Zilla::Plugin::Author::Plicease::ReadmeAnyFromPod 2.79 {

  use 5.020;
  use Moose;
  use experimental qw( signatures );
  use URI::Escape ();
  use File::Which ();
  use Ref::Util qw( is_plain_hashref );
  use experimental qw( postderef );

# ABSTRACT: Personal subclass of Dist::Zilla::Plugin::ReadmeAnyFromPod


  extends 'Dist::Zilla::Plugin::ReadmeAnyFromPod';

  around BUILDARGS => sub {
    my $orig = shift;
    my $class = shift;

    my %args = @_ == 1 && is_plain_hashref($_[0]) ? $_[0]->%* : @_;
    foreach my $key (keys %args)
    {
      die "removed key: $key"
        if $key =~ /^(travis_.*|appveyor_user|appveyor)$/;
    }

    return $class->$orig(@_);
  };

  has github_user => (
    is      => 'ro',
    default => 'plicease',
  );

  has github_repo => (
    is      => 'ro',
    lazy    => 1,
    default => sub ($self) {
      $self->zilla->name
    },
  );

  has workflow => (
    is      => 'ro',
    isa     => 'ArrayRef[Str]',
    default => sub { [] },
  );

  has default_branch => (
    is      => 'ro',
    lazy    => 1,
    default => sub ($self) {
      if(File::Which::which('git'))
      {
        my %b = map { $_ => 1 }
                map { s/\s$//r }
                map { s/^\*?\s*//r }
                `git branch`;
        if($b{main} && $b{master})
        {
          $self->log("!! You have both a main and master branch, please switch to just a main branch (or explicitly set default_branch) !!");
          return 'main';
        }
        elsif($b{main})
        {
          $self->log("deteching main as default branch");
          return 'main';
        }



( run in 1.103 second using v1.01-cache-2.11-cpan-6aa56a78535 )