| 1 | package Dist::Zilla::PluginBundle::GitHub; | ||
| 2 | # ABSTRACT: GitHub plugins all-in-one | ||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | our $VERSION = '0.49'; | ||
| 7 | |||
| 8 | use Moose; | ||
| 9 | |||
| 10 | extends 'Dist::Zilla::Plugin::GitHub'; | ||
| 11 | |||
| 12 | with 'Dist::Zilla::Role::PluginBundle::Easy'; | ||
| 13 | |||
| 14 | has '+repo' => ( | ||
| 15 | lazy => 1, | ||
| 16 | default => sub { $_[0]->payload->{repo} } | ||
| 17 | ); | ||
| 18 | |||
| 19 | has '+prompt_2fa' => ( | ||
| 20 | lazy => 1, | ||
| 21 | default => sub { $_[0]->payload->{prompt_2fa} } | ||
| 22 | ); | ||
| 23 | |||
| 24 | # GitHub::Meta | ||
| 25 | |||
| 26 | has homepage => ( | ||
| 27 | is => 'ro', | ||
| 28 | isa => 'Bool', | ||
| 29 | lazy => 1, | ||
| 30 | default => sub { | ||
| 31 | defined $_[0]->payload->{homepage} ? | ||
| 32 | $_[0]->payload->{homepage} : 1 | ||
| 33 | } | ||
| 34 | ); | ||
| 35 | |||
| 36 | has bugs => ( | ||
| 37 | is => 'ro', | ||
| 38 | isa => 'Bool', | ||
| 39 | lazy => 1, | ||
| 40 | default => sub { | ||
| 41 | defined $_[0]->payload->{bugs} ? | ||
| 42 | $_[0]->payload->{bugs} : 1 | ||
| 43 | } | ||
| 44 | ); | ||
| 45 | |||
| 46 | has wiki => ( | ||
| 47 | is => 'ro', | ||
| 48 | isa => 'Bool', | ||
| 49 | lazy => 1, | ||
| 50 | default => sub { | ||
| 51 | defined $_[0]->payload->{wiki} ? | ||
| 52 | $_[0]->payload->{wiki} : 0 | ||
| 53 | } | ||
| 54 | ); | ||
| 55 | |||
| 56 | has fork => ( | ||
| 57 | is => 'ro', | ||
| 58 | isa => 'Bool', | ||
| 59 | lazy => 1, | ||
| 60 | default => sub { | ||
| 61 | defined $_[0]->payload->{fork} ? | ||
| 62 | $_[0]->payload->{fork} : 1 | ||
| 63 | } | ||
| 64 | ); | ||
| 65 | |||
| 66 | # GitHub::Update | ||
| 67 | |||
| 68 | # deprecated and no longer documented. Use 'metacpan' instead! | ||
| 69 | has cpan => ( | ||
| 70 | is => 'ro', | ||
| 71 | isa => 'Bool', | ||
| 72 | lazy => 1, | ||
| 73 | default => sub { | ||
| 74 | defined $_[0]->payload->{cpan} ? | ||
| 75 | $_[0]->payload->{cpan} : 1 | ||
| 76 | } | ||
| 77 | ); | ||
| 78 | |||
| 79 | has p3rl => ( | ||
| 80 | is => 'ro', | ||
| 81 | isa => 'Bool', | ||
| 82 | lazy => 1, | ||
| 83 | default => sub { | ||
| 84 | defined $_[0]->payload->{p3rl} ? | ||
| 85 | $_[0]->payload->{p3rl} : 0 | ||
| 86 | } | ||
| 87 | ); | ||
| 88 | |||
| 89 | has metacpan => ( | ||
| 90 | is => 'ro', | ||
| 91 | isa => 'Bool', | ||
| 92 | lazy => 1, | ||
| 93 | default => sub { | ||
| 94 | defined $_[0]->payload->{metacpan} ? | ||
| 95 | $_[0]->payload->{metacpan} : 0 | ||
| 96 | } | ||
| 97 | ); | ||
| 98 | |||
| 99 | has meta_home => ( | ||
| 100 | is => 'ro', | ||
| 101 | isa => 'Bool', | ||
| 102 | lazy => 1, | ||
| 103 | default => sub { | ||
| 104 | defined $_[0]->payload->{meta_home} ? | ||
| 105 | $_[0]->payload->{meta_home} : 0 | ||
| 106 | } | ||
| 107 | ); | ||
| 108 | |||
| 109 | #pod =head1 SYNOPSIS | ||
| 110 | #pod | ||
| 111 | #pod Configure git with your GitHub credentials: | ||
| 112 | #pod | ||
| 113 | #pod $ git config --global github.user LoginName | ||
| 114 | #pod $ git config --global github.password GitHubPassword | ||
| 115 | #pod | ||
| 116 | #pod Alternatively you can install L<Config::Identity> and write your credentials | ||
| 117 | #pod in the (optionally GPG-encrypted) C<~/.github> file as follows: | ||
| 118 | #pod | ||
| 119 | #pod login LoginName | ||
| 120 | #pod password GitHubpassword | ||
| 121 | #pod | ||
| 122 | #pod (if only the login name is set, the password will be asked interactively) | ||
| 123 | #pod | ||
| 124 | #pod then, in your F<dist.ini>: | ||
| 125 | #pod | ||
| 126 | #pod [@GitHub] | ||
| 127 | #pod repo = SomeRepo | ||
| 128 | #pod | ||
| 129 | #pod =head1 DESCRIPTION | ||
| 130 | #pod | ||
| 131 | #pod This bundle automatically adds the plugins | ||
| 132 | #pod L<GitHub::Meta|Dist::Zilla::Plugin::GitHub::Meta> | ||
| 133 | #pod and L<[GitHub::Update|Dist::Zilla::Plugin::GitHub::Update>. | ||
| 134 | #pod | ||
| 135 | #pod =cut | ||
| 136 | |||
| 137 | sub configure { | ||
| 138 | my $self = shift; | ||
| 139 | |||
| 140 | $self->add_plugins( | ||
| 141 | ['GitHub::Meta' => { | ||
| 142 | repo => $self->repo, | ||
| 143 | homepage => $self->homepage, | ||
| 144 | bugs => $self->bugs, | ||
| 145 | wiki => $self->wiki, | ||
| 146 | fork => $self->fork | ||
| 147 | }], | ||
| 148 | |||
| 149 | ['GitHub::Update' => { | ||
| 150 | repo => $self->repo, | ||
| 151 | cpan => $self->cpan, | ||
| 152 | p3rl => $self->p3rl, | ||
| 153 | metacpan => $self->metacpan, | ||
| 154 | meta_home => $self->meta_home, | ||
| 155 | prompt_2fa => $self->prompt_2fa | ||
| 156 | }] | ||
| 157 | ); | ||
| 158 | } | ||
| 159 | |||
| 160 | __PACKAGE__->meta->make_immutable; | ||
| 161 | 1; # End of Dist::Zilla::PluginBundle::GitHub | ||
| 162 | |||
| 163 | __END__ |