line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
38337
|
use 5.14.0; |
|
1
|
|
|
|
|
4
|
|
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
56
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Dist::Iller::Config; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY |
8
|
|
|
|
|
|
|
# ABSTRACT: Role for Dist::Iller configs |
9
|
|
|
|
|
|
|
our $VERSION = '0.1410'; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
6
|
use Moose::Role; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
12
|
1
|
|
|
1
|
|
5565
|
use MooseX::AttributeShortcuts; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
12
|
|
13
|
1
|
|
|
1
|
|
33175
|
use namespace::autoclean; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
14
|
1
|
|
|
1
|
|
92
|
use Module::Load qw/load/; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
12
|
|
15
|
1
|
|
|
1
|
|
100
|
use Types::Standard qw/Bool Str Maybe InstanceOf/; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
11
|
|
16
|
1
|
|
|
1
|
|
1122
|
use YAML::Tiny; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
72
|
|
17
|
1
|
|
|
1
|
|
8
|
use Path::Tiny; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
63
|
|
18
|
1
|
|
|
1
|
|
7
|
use Try::Tiny; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
56
|
|
19
|
1
|
|
|
1
|
|
6
|
use Carp qw/croak/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
66
|
|
20
|
1
|
|
|
1
|
|
7
|
use File::ShareDir 'dist_dir'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
51
|
|
21
|
1
|
|
|
1
|
|
6
|
use String::CamelCase qw/camelize/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
685
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
requires qw/filepath/; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has main_module => ( |
26
|
|
|
|
|
|
|
is => 'ro', |
27
|
|
|
|
|
|
|
isa => Str, |
28
|
|
|
|
|
|
|
lazy => 1, |
29
|
|
|
|
|
|
|
traits => ['Documented'], |
30
|
|
|
|
|
|
|
default => sub { shift->meta->name }, |
31
|
|
|
|
|
|
|
documentation => q{Override this attribute when there's more than one config in a distribution. It uses the main_module's sharedir location for the config files.}, |
32
|
|
|
|
|
|
|
documentation_default => 'The package name', |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
has distribution_name => ( |
35
|
|
|
|
|
|
|
is => 'ro', |
36
|
|
|
|
|
|
|
isa => Str, |
37
|
|
|
|
|
|
|
lazy => 1, |
38
|
|
|
|
|
|
|
predicate => 1, |
39
|
|
|
|
|
|
|
default => sub { undef }, |
40
|
|
|
|
|
|
|
traits => ['Documented'], |
41
|
|
|
|
|
|
|
documentation_order => 0, |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
has global => ( |
44
|
|
|
|
|
|
|
is => 'ro', |
45
|
|
|
|
|
|
|
isa => Maybe[InstanceOf['Dist::Iller::DocType::Global']], |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub config_location { |
50
|
3
|
|
|
3
|
0
|
7
|
my $self = shift; |
51
|
3
|
|
|
|
|
118
|
my $package = $self->main_module; |
52
|
3
|
|
|
|
|
17
|
$package =~ s{::}{-}g; |
53
|
|
|
|
|
|
|
|
54
|
3
|
|
|
|
|
20
|
my $dir = path('.'); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
try { |
57
|
3
|
|
|
3
|
|
204
|
$dir = path(dist_dir($package)); |
58
|
|
|
|
|
|
|
} |
59
|
3
|
|
|
3
|
|
163
|
finally { }; |
60
|
|
|
|
|
|
|
|
61
|
3
|
|
|
|
|
45
|
return $dir->child($self->filepath); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub get_yaml_for { |
65
|
3
|
|
|
3
|
0
|
8
|
my $self = shift; |
66
|
3
|
|
|
|
|
6
|
my $doctype = shift; |
67
|
|
|
|
|
|
|
|
68
|
3
|
|
|
|
|
10
|
my $fullyaml = YAML::Tiny->read($self->config_location->absolute->stringify); |
69
|
|
|
|
|
|
|
|
70
|
3
|
|
|
|
|
19384
|
my $yaml = (grep { $_->{'doctype'} eq $doctype } @{ $fullyaml })[0]; |
|
9
|
|
|
|
|
25
|
|
|
3
|
|
|
|
|
10
|
|
71
|
3
|
50
|
|
|
|
13
|
return if !defined $yaml; |
72
|
|
|
|
|
|
|
|
73
|
3
|
|
|
|
|
16
|
my $doctype_class = sprintf 'Dist::Iller::DocType::%s', camelize($yaml->{'doctype'}); |
74
|
|
|
|
|
|
|
try { |
75
|
3
|
|
|
3
|
|
151
|
load $doctype_class; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
catch { |
78
|
0
|
|
|
0
|
|
0
|
croak "Can't load $doctype_class: $_"; |
79
|
3
|
|
|
|
|
74
|
}; |
80
|
|
|
|
|
|
|
|
81
|
3
|
|
|
|
|
390
|
return $doctype_class->new(config_obj => $self)->parse($yaml)->to_yaml; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
__END__ |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=pod |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=encoding UTF-8 |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 NAME |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Dist::Iller::Config - Role for Dist::Iller configs |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 VERSION |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Version 0.1410, released 2020-12-31. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 SOURCE |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
L<https://github.com/Csson/p5-Dist-Iller> |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 HOMEPAGE |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
L<https://metacpan.org/release/Dist-Iller> |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 AUTHOR |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Erik Carlsson <info@code301.com> |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This software is copyright (c) 2020 by Erik Carlsson. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
118
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |