line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Role::PluginBundle::Zilla; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
3248121
|
use 5.006; |
|
2
|
|
|
|
|
7
|
|
4
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
45
|
|
5
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
82
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
490
|
use Moose::Role; |
|
2
|
|
|
|
|
501299
|
|
|
2
|
|
|
|
|
26
|
|
10
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::PluginBundle'; |
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
11405
|
use List::Util qw(first); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
182
|
|
13
|
2
|
|
|
2
|
|
17
|
use Moose::Util::TypeConstraints qw(class_type); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
13
|
|
14
|
2
|
|
|
2
|
|
908
|
use Scalar::Util qw(weaken); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
122
|
|
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
|
713
|
use namespace::autoclean; |
|
2
|
|
|
|
|
8467
|
|
|
2
|
|
|
|
|
11
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has name => ( |
19
|
|
|
|
|
|
|
is => 'ro', |
20
|
|
|
|
|
|
|
isa => 'Str', |
21
|
|
|
|
|
|
|
required => 1, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has zilla => ( |
25
|
|
|
|
|
|
|
is => 'ro', |
26
|
|
|
|
|
|
|
isa => class_type('Dist::Zilla'), |
27
|
|
|
|
|
|
|
init_arg => undef, |
28
|
|
|
|
|
|
|
weak_ref => 1, |
29
|
|
|
|
|
|
|
lazy => 1, |
30
|
|
|
|
|
|
|
builder => '_build_zilla', |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
has logger => ( |
34
|
|
|
|
|
|
|
is => 'ro', |
35
|
|
|
|
|
|
|
lazy => 1, |
36
|
|
|
|
|
|
|
handles => [qw(log log_debug log_fatal)], |
37
|
|
|
|
|
|
|
default => sub { |
38
|
|
|
|
|
|
|
$_[0]->zilla->chrome->logger->proxy( |
39
|
|
|
|
|
|
|
{ |
40
|
|
|
|
|
|
|
proxy_prefix => '[' . $_[0]->name . '] ', |
41
|
|
|
|
|
|
|
}, |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
}, |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
{ |
47
|
|
|
|
|
|
|
my %zilla; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
around 'register_component' => sub { |
50
|
|
|
|
|
|
|
my ( $orig, $class, $name, $arg, $section ) = @_; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my @sections = $section->sequence->sections; |
53
|
|
|
|
|
|
|
my ($root_section) = first { $_->name eq q{_} } @sections; |
54
|
|
|
|
|
|
|
my $zilla = $root_section->zilla; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
$zilla{$name} = $zilla; |
57
|
|
|
|
|
|
|
weaken( $zilla{$name} ); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
return $class->$orig( $name, $arg, $section ); |
60
|
|
|
|
|
|
|
}; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub _build_zilla { |
63
|
4
|
|
|
4
|
|
12
|
my ($self) = @_; |
64
|
|
|
|
|
|
|
|
65
|
4
|
|
|
|
|
123
|
my $name = $self->name; |
66
|
|
|
|
|
|
|
|
67
|
4
|
|
|
|
|
25
|
my $zilla = delete $zilla{$name}; |
68
|
4
|
|
|
|
|
131
|
return $zilla; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub BUILD { |
73
|
4
|
|
|
4
|
0
|
3683
|
my ($self) = @_; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# move the zilla object from our hash to the object |
76
|
4
|
|
|
|
|
140
|
$self->zilla; |
77
|
|
|
|
|
|
|
|
78
|
4
|
|
|
|
|
120
|
return; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__END__ |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=pod |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=encoding UTF-8 |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 NAME |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Dist::Zilla::Role::PluginBundle::Zilla - adds the zilla object and the logger to your bundles |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 VERSION |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Version 0.001 |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 SYNOPSIS |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 Dist::Zilla::Role::PluginBundle |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
package Dist::Zilla::PluginBundle::MyBundle; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
use Moose; |
104
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::PluginBundle::Zilla'; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub bundle_config { |
107
|
|
|
|
|
|
|
my ( $class, $section ) = @_; |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
my $self = $class->new($section); |
110
|
|
|
|
|
|
|
$self->log('Hello from your friendly bundle! We are running in ' . $self->zilla->root); |
111
|
|
|
|
|
|
|
$self->log_fatal('Something went wrong...'); |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
return; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 Dist::Zilla::Role::PluginBundle::Easy |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
package Dist::Zilla::PluginBundle::MyBundle; |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
use Moose; |
121
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::PluginBundle::Easy'; |
122
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::PluginBundle::Zilla'; |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub configure { |
125
|
|
|
|
|
|
|
my ($self) = @_; |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
$self->log('Hello from your friendly bundle! We are running in ' . $self->zilla->root); |
128
|
|
|
|
|
|
|
$self->log_fatal('Something went wrong...'); |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
return; |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 DESCRIPTION |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
This role makes the C<zilla> object available and adds the C<log>, |
137
|
|
|
|
|
|
|
C<log_fatal>, and C<log_debug> methods to your bundle. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
This allows you to use the same logging procedure in your bundle that plugins |
140
|
|
|
|
|
|
|
use. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
If you use L<Dist::Zilla::Role::PluginBundle::Easy> you have to import these |
143
|
|
|
|
|
|
|
two roles with two separate calls to C<with> because both roles declare the |
144
|
|
|
|
|
|
|
name attribute. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 SUPPORT |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head2 Bugs / Feature Requests |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Please report any bugs or feature requests through the issue tracker |
151
|
|
|
|
|
|
|
at L<https://github.com/skirmess/Dist-Zilla-Role-PluginBundle-Zilla/issues>. |
152
|
|
|
|
|
|
|
You will be notified automatically of any progress on your issue. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head2 Source Code |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
This is open source software. The code repository is available for |
157
|
|
|
|
|
|
|
public review and contribution under the terms of the license. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
L<https://github.com/skirmess/Dist-Zilla-Role-PluginBundle-Zilla> |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
git clone https://github.com/skirmess/Dist-Zilla-Role-PluginBundle-Zilla.git |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 AUTHOR |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Sven Kirmess <sven.kirmess@kzone.ch> |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
This software is Copyright (c) 2020 by Sven Kirmess. |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
This is free software, licensed under: |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
The (two-clause) FreeBSD License |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 SEE ALSO |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
L<Dist::Zilla::Role::PluginBundle>, |
178
|
|
|
|
|
|
|
L<Dist::Zilla::Role::PluginBundle::Easy> |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=cut |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
# vim: ts=4 sts=4 sw=4 et: syntax=perl |