| 1 | package Dist::Zilla::Plugin::GitIgnore; | ||||||||||
| 2 | 1 | $Dist::Zilla::Plugin::GitIgnore::VERSION = '0.003'; | |||||||||
| 3 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | with qw/Dist::Zilla::Role::FileGatherer/; | |||||||||
| 5 | 1 | ▶ | use MooseX::Types::Moose qw/ArrayRef Str Bool/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | use experimental 'signatures'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 1 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 0 | ▶ | sub mvp_multivalue_args($class) { | ||||||||
|
Subroutine
mvp_multivalue_args: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 12 | 0 | return 'extras'; | |||||||||
| 13 | } | ||||||||||
| 14 | |||||||||||
| 15 | 0 | ▶ | sub mvp_aliases($class) { | ||||||||
|
Subroutine
mvp_aliases: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 16 | 0 | return { extra => 'extras' }; | |||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | 1 | has filename => ( | |||||||||
| 20 | is => 'ro', | ||||||||||
| 21 | isa => Str, | ||||||||||
| 22 | default => '.gitignore', | ||||||||||
| 23 | ); | ||||||||||
| 24 | |||||||||||
| 25 | has extras => ( | ||||||||||
| 26 | isa => ArrayRef[Str], | ||||||||||
| 27 | traits => ['Array'], | ||||||||||
| 28 | 0 | ▶ | default => sub { [] }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 29 | 1 | handles => { | |||||||||
| 30 | extras => 'elements', | ||||||||||
| 31 | }, | ||||||||||
| 32 | ); | ||||||||||
| 33 | |||||||||||
| 34 | 1 | has skip_gitignore_override => ( | |||||||||
| 35 | is => 'ro', | ||||||||||
| 36 | isa => Bool, | ||||||||||
| 37 | default => !!0, | ||||||||||
| 38 | ); | ||||||||||
| 39 | |||||||||||
| 40 | 1 | has skip_defaults => ( | |||||||||
| 41 | is => 'ro', | ||||||||||
| 42 | isa => Bool, | ||||||||||
| 43 | default => !!0, | ||||||||||
| 44 | ); | ||||||||||
| 45 | |||||||||||
| 46 | 0 | ▶ | sub gather_files($self) { | ||||||||
|
Subroutine
gather_files: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 47 | 0 | my @patterns; | |||||||||
| 48 | 0 | ▶ | if (not $self->skip_defaults) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | 0 | my $name = $self->zilla->name; | |||||||||
| 50 | 0 | push @patterns, '/.build/', "/$name-*/", "/$name-*.tar.gz"; | |||||||||
| 51 | } | ||||||||||
| 52 | 0 | ▶ | push @patterns, '!/.gitignore' if not $self->skip_gitignore_override; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 53 | |||||||||||
| 54 | 0 | push @patterns, $self->extras; | |||||||||
| 55 | |||||||||||
| 56 | 0 | my $payload = join '', map { "$_\n" } @patterns; | |||||||||
| 57 | 0 | $self->add_file(Dist::Zilla::File::InMemory->new( | |||||||||
| 58 | name => $self->filename, | ||||||||||
| 59 | content => $payload, | ||||||||||
| 60 | )); | ||||||||||
| 61 | |||||||||||
| 62 | 0 | return; | |||||||||
| 63 | } | ||||||||||
| 64 | |||||||||||
| 65 | 1 | 1; | |||||||||
| 66 | |||||||||||
| 67 | # ABSTRACT: Add .gitignore during minting | ||||||||||
| 68 | |||||||||||
| 69 | __END__ | ||||||||||