line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
39082
|
use 5.10.0; |
|
1
|
|
|
|
|
4
|
|
2
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
88
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Dist::Iller::Config; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY |
8
|
|
|
|
|
|
|
# ABSTRACT: Role for Dist::Iller configs |
9
|
|
|
|
|
|
|
our $VERSION = '0.1409'; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
8
|
use Moose::Role; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
12
|
1
|
|
|
1
|
|
5839
|
use MooseX::AttributeShortcuts; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
14
|
|
13
|
1
|
|
|
1
|
|
34038
|
use namespace::autoclean; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
27
|
|
14
|
1
|
|
|
1
|
|
116
|
use Module::Load qw/load/; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
10
|
|
15
|
1
|
|
|
1
|
|
99
|
use Types::Standard qw/Bool Str Maybe InstanceOf/; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
11
|
|
16
|
1
|
|
|
1
|
|
1167
|
use YAML::Tiny; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
68
|
|
17
|
1
|
|
|
1
|
|
6
|
use Path::Tiny; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
60
|
|
18
|
1
|
|
|
1
|
|
19
|
use Try::Tiny; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
66
|
|
19
|
1
|
|
|
1
|
|
7
|
use Carp qw/croak/; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
70
|
|
20
|
1
|
|
|
1
|
|
809
|
use File::ShareDir 'dist_dir'; |
|
1
|
|
|
|
|
18989
|
|
|
1
|
|
|
|
|
75
|
|
21
|
1
|
|
|
1
|
|
17
|
use String::CamelCase qw/camelize/; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
658
|
|
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
|
5
|
my $self = shift; |
51
|
3
|
|
|
|
|
108
|
my $package = $self->main_module; |
52
|
3
|
|
|
|
|
20
|
$package =~ s{::}{-}g; |
53
|
|
|
|
|
|
|
|
54
|
3
|
|
|
|
|
20
|
my $dir = path('.'); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
try { |
57
|
3
|
|
|
3
|
|
238
|
$dir = path(dist_dir($package)); |
58
|
|
|
|
|
|
|
} |
59
|
3
|
|
|
3
|
|
205
|
finally { }; |
60
|
|
|
|
|
|
|
|
61
|
3
|
|
|
|
|
54
|
return $dir->child($self->filepath); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub get_yaml_for { |
65
|
3
|
|
|
3
|
0
|
16
|
my $self = shift; |
66
|
3
|
|
|
|
|
9
|
my $doctype = shift; |
67
|
|
|
|
|
|
|
|
68
|
3
|
|
|
|
|
19
|
my $fullyaml = YAML::Tiny->read($self->config_location->absolute->stringify); |
69
|
|
|
|
|
|
|
|
70
|
3
|
|
|
|
|
19481
|
my $yaml = (grep { $_->{'doctype'} eq $doctype } @{ $fullyaml })[0]; |
|
9
|
|
|
|
|
26
|
|
|
3
|
|
|
|
|
11
|
|
71
|
3
|
50
|
|
|
|
11
|
return if !defined $yaml; |
72
|
|
|
|
|
|
|
|
73
|
3
|
|
|
|
|
15
|
my $doctype_class = sprintf 'Dist::Iller::DocType::%s', camelize($yaml->{'doctype'}); |
74
|
|
|
|
|
|
|
try { |
75
|
3
|
|
|
3
|
|
155
|
load $doctype_class; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
catch { |
78
|
0
|
|
|
0
|
|
0
|
croak "Can't load $doctype_class: $_"; |
79
|
3
|
|
|
|
|
75
|
}; |
80
|
|
|
|
|
|
|
|
81
|
3
|
|
|
|
|
384
|
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.1409, released 2020-12-27. |
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) 2016 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 |