| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
739
|
use 5.14.0; |
|
|
1
|
|
|
|
|
5
|
|
|
2
|
1
|
|
|
1
|
|
7
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
27
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
72
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Dist::Iller::DocType::Gitignore; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY |
|
8
|
|
|
|
|
|
|
# ABSTRACT: Turn the Dist::Iller config into a .gitignore file |
|
9
|
|
|
|
|
|
|
our $VERSION = '0.1411'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
6
|
use Dist::Iller::Elk; |
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
10
|
|
|
12
|
1
|
|
|
1
|
|
2398
|
use Path::Tiny; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
84
|
|
|
13
|
1
|
|
|
1
|
|
9
|
use Types::Standard qw/ArrayRef Str/; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
10
|
|
|
14
|
|
|
|
|
|
|
with qw/ |
|
15
|
|
|
|
|
|
|
Dist::Iller::DocType |
|
16
|
|
|
|
|
|
|
/; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
for my $setting (qw/always onexist/) { |
|
19
|
|
|
|
|
|
|
has $setting => ( |
|
20
|
|
|
|
|
|
|
is => 'ro', |
|
21
|
|
|
|
|
|
|
isa => ArrayRef[Str], |
|
22
|
|
|
|
|
|
|
traits => ['Array'], |
|
23
|
|
|
|
|
|
|
default => sub { [ ] }, |
|
24
|
|
|
|
|
|
|
handles => { |
|
25
|
|
|
|
|
|
|
"add_$setting" => 'push', |
|
26
|
|
|
|
|
|
|
"all_$setting" => 'elements', |
|
27
|
|
|
|
|
|
|
"get_$setting" => 'get', |
|
28
|
|
|
|
|
|
|
"set_$setting" => 'set', |
|
29
|
|
|
|
|
|
|
}, |
|
30
|
|
|
|
|
|
|
); |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
4
|
|
|
4
|
0
|
18
|
sub comment_start { '#' } |
|
34
|
|
|
|
|
|
|
|
|
35
|
3
|
|
|
3
|
0
|
41
|
sub filename { '.gitignore' } |
|
36
|
|
|
|
|
|
|
|
|
37
|
4
|
|
|
4
|
0
|
26
|
sub phase { 'after' } |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub to_hash { |
|
40
|
1
|
|
|
1
|
0
|
3
|
my $self = shift; |
|
41
|
1
|
|
|
|
|
33
|
return { always => $self->always, onexist => $self->onexist }; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub parse { |
|
45
|
|
|
|
|
|
|
my $self = shift; |
|
46
|
|
|
|
|
|
|
my $yaml = shift; |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
if(exists $yaml->{'config'}) { |
|
49
|
|
|
|
|
|
|
# ugly hack.. |
|
50
|
|
|
|
|
|
|
$self->parse_config({ '+config' => $yaml->{'config'} }); |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
if(exists $yaml->{'always'}) { |
|
53
|
|
|
|
|
|
|
$self->add_always($_) for @{ $yaml->{'always'} }; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
if(exists $yaml->{'onexist'}) { |
|
56
|
|
|
|
|
|
|
$self->add_onexist($_) for grep { path($_)->exists } @{ $yaml->{'onexist'} }; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
if ($self->global && $self->global->has_distribution_name) { |
|
60
|
|
|
|
|
|
|
for my $type (qw/always onexist/) { |
|
61
|
|
|
|
|
|
|
my $all = "all_$type"; |
|
62
|
|
|
|
|
|
|
my $get = "get_$type"; |
|
63
|
|
|
|
|
|
|
my $set = "set_$type"; |
|
64
|
|
|
|
|
|
|
for my $index (0.. scalar $self->$all - 1) { |
|
65
|
|
|
|
|
|
|
my $item = $self->$get($index); |
|
66
|
|
|
|
|
|
|
$self->$set($index, '/'.$self->global->distribution_name.'-*') if $item eq '$self.distribution_name'; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub to_string { |
|
73
|
|
|
|
|
|
|
my $self = shift; |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
return join "\n", ($self->all_always, $self->all_onexist, ''); |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__END__ |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=pod |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=encoding UTF-8 |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 NAME |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Dist::Iller::DocType::Gitignore - Turn the Dist::Iller config into a .gitignore file |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 VERSION |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Version 0.1411, released 2020-01-01. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 SOURCE |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
L<https://github.com/Csson/p5-Dist-Iller> |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 HOMEPAGE |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
L<https://metacpan.org/release/Dist-Iller> |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 AUTHOR |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Erik Carlsson <info@code301.com> |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This software is copyright (c) 2021 by Erik Carlsson. |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
113
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |