| 1 | package Dist::Zilla::Plugin::Covenant; | ||
| 2 | 2 | our $AUTHORITY = 'cpan:YANICK'; | |
| 3 | # ABSTRACT: add the author's pledge to the distribution | ||
| 4 | 2 | $Dist::Zilla::Plugin::Covenant::VERSION = '0.1.3'; | |
| 5 | |||
| 6 | 2 | ▶ | use 5.20.0; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 2 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 2 | ▶ | use Dist::Zilla::File::InMemory; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | 2 | with qw/ | |
| 13 | Dist::Zilla::Role::Plugin | ||
| 14 | Dist::Zilla::Role::FileGatherer | ||
| 15 | Dist::Zilla::Role::TextTemplate | ||
| 16 | Dist::Zilla::Role::MetaProvider | ||
| 17 | /; | ||
| 18 | |||
| 19 | 2 | ▶ | use experimental 'signatures'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 20 | |||
| 21 | 2 | has pledge_file => ( | |
| 22 | is => 'ro', | ||
| 23 | default => 'AUTHOR_PLEDGE', | ||
| 24 | ); | ||
| 25 | |||
| 26 | 1 | ▶ | sub metadata { |
|
Subroutine
metadata: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 27 | 1 | return { 'x_author_pledge' => { 'version' => 1 } }; | |
| 28 | } | ||
| 29 | |||
| 30 | 2 | has '+zilla' => ( | |
| 31 | handles => { | ||
| 32 | distribution_name => 'name', | ||
| 33 | authors => 'authors', | ||
| 34 | } | ||
| 35 | ); | ||
| 36 | |||
| 37 | has pledge => ( | ||
| 38 | is => 'ro', | ||
| 39 | lazy => 1, | ||
| 40 | 1 | ▶ | default => sub($self) { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 41 | $self->fill_in_string( | ||
| 42 | pledge_template(), { | ||
| 43 | distribution => $self->distribution_name, | ||
| 44 | 1 | author => join ', ', @{ $self->authors }, | |
| 45 | } | ||
| 46 | ); | ||
| 47 | }, | ||
| 48 | 2 | ); | |
| 49 | |||
| 50 | 1 | ▶ | sub gather_files ($self) { |
|
Subroutine
gather_files: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 51 | 1 | $self->add_file( | |
| 52 | Dist::Zilla::File::InMemory->new({ | ||
| 53 | content => $self->pledge, | ||
| 54 | name => $self->pledge_file, | ||
| 55 | }) | ||
| 56 | ); | ||
| 57 | } | ||
| 58 | |||
| 59 | 1 | ▶ | sub pledge_template { |
|
Subroutine
pledge_template: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 60 | 1 | return <<'END_PLEDGE'; | |
| 61 | |||
| 62 | # CPAN Covenant for {{ $distribution }} | ||
| 63 | |||
| 64 | I, {{ $author }}, hereby give modules@perl.org permission to grant co-maintainership | ||
| 65 | to {{ $distribution }}, if all the following conditions are met: | ||
| 66 | |||
| 67 | (1) I haven't released the module for a year or more | ||
| 68 | (2) There are outstanding issues in the module's public bug tracker | ||
| 69 | (3) Email to my CPAN email address hasn't been answered after a month | ||
| 70 | (4) The requester wants to make worthwhile changes that will benefit CPAN | ||
| 71 | |||
| 72 | In the event of my death, then the time-limits in (1) and (3) do not apply. | ||
| 73 | |||
| 74 | END_PLEDGE | ||
| 75 | } | ||
| 76 | |||
| 77 | 2 | __PACKAGE__->meta->make_immutable; | |
| 78 | |||
| 79 | 2 | 1; | |
| 80 | |||
| 81 | __END__ | ||