line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
5
|
|
|
5
|
|
1149888
|
use 5.008; # utf8 |
|
5
|
|
|
|
|
12
|
|
2
|
5
|
|
|
5
|
|
18
|
use strict; |
|
5
|
|
|
|
|
4
|
|
|
5
|
|
|
|
|
95
|
|
3
|
5
|
|
|
5
|
|
27
|
use warnings; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
152
|
|
4
|
5
|
|
|
5
|
|
529
|
use utf8; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
33
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::Bootstrap::ShareDir::Dist; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.001002'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: Use a share directory on your dist during bootstrap |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
13
|
|
|
|
|
|
|
|
14
|
5
|
|
|
5
|
|
818
|
use Moose qw( with around has ); |
|
5
|
|
|
|
|
295397
|
|
|
5
|
|
|
|
|
34
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::Bootstrap'; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
around dump_config => sub { |
32
|
|
|
|
|
|
|
my ( $orig, $self, @args ) = @_; |
33
|
|
|
|
|
|
|
my $config = $self->$orig(@args); |
34
|
|
|
|
|
|
|
my $localconf = $config->{ +__PACKAGE__ } = {}; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
if ( $self->meta->find_attribute_by_name('dir')->has_value($self) ) { |
37
|
|
|
|
|
|
|
$localconf->{dir} = $self->dir; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
$localconf->{ q[$] . __PACKAGE__ . '::VERSION' } = $VERSION |
41
|
|
|
|
|
|
|
unless __PACKAGE__ eq ref $self; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
return $config; |
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
has dir => ( |
51
|
|
|
|
|
|
|
is => ro =>, |
52
|
|
|
|
|
|
|
lazy_build => 1, |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub _build_dir { |
56
|
4
|
|
|
4
|
|
127
|
return 'share'; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
60
|
5
|
|
|
5
|
|
23848
|
no Moose; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
25
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub do_bootstrap_sharedir { |
69
|
4
|
|
|
4
|
1
|
8
|
my ( $self, ) = @_; |
70
|
|
|
|
|
|
|
|
71
|
4
|
|
|
|
|
129
|
my $root = $self->_bootstrap_root; |
72
|
|
|
|
|
|
|
|
73
|
4
|
50
|
|
|
|
2163
|
if ( not defined $root ) { |
74
|
0
|
|
|
|
|
0
|
$self->log( ['Not bootstrapping'] ); |
75
|
0
|
|
|
|
|
0
|
return; |
76
|
|
|
|
|
|
|
} |
77
|
4
|
|
|
|
|
137
|
my $sharedir = $root->child( $self->dir ); |
78
|
4
|
|
|
|
|
88
|
$self->log( [ 'Bootstrapping %s for sharedir for %s', "$sharedir", $self->distname ] ); |
79
|
4
|
|
|
|
|
3248
|
require Test::File::ShareDir::Object::Dist; |
80
|
4
|
|
|
|
|
10155
|
my $share_object = Test::File::ShareDir::Object::Dist->new( dists => { $self->distname => $sharedir } ); |
81
|
4
|
|
|
|
|
294
|
for my $dist ( $share_object->dist_names ) { |
82
|
4
|
|
|
|
|
111
|
$self->log_debug( |
83
|
|
|
|
|
|
|
[ |
84
|
|
|
|
|
|
|
'Installing dist %s ( %s => %s )', |
85
|
|
|
|
|
|
|
"$dist", |
86
|
|
|
|
|
|
|
$share_object->dist_share_source_dir($dist) . q{}, |
87
|
|
|
|
|
|
|
$share_object->dist_share_target_dir($dist) . q{}, |
88
|
|
|
|
|
|
|
], |
89
|
|
|
|
|
|
|
); |
90
|
4
|
|
|
|
|
9149
|
$share_object->install_dist($dist); |
91
|
|
|
|
|
|
|
} |
92
|
4
|
|
|
|
|
4140
|
require lib; |
93
|
4
|
|
|
|
|
85
|
lib->import( $share_object->inc->tempdir . q{} ); |
94
|
4
|
|
|
|
|
585
|
$self->log_debug( [ 'Sharedir for %s installed to %s', $self->distname, $share_object->inc->dist_tempdir . q{} ] ); |
95
|
4
|
|
|
|
|
337
|
return; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub bootstrap { |
105
|
4
|
|
|
4
|
|
27
|
my $self = shift; |
106
|
4
|
|
|
|
|
13
|
return $self->do_bootstrap_sharedir; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
1; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
__END__ |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=pod |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=encoding UTF-8 |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 NAME |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Bootstrap::ShareDir::Dist - Use a share directory on your dist during bootstrap |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 VERSION |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
version 1.001002 |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 DESCRIPTION |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
This module allows one to load a C<Dist> styled C<ShareDir> using a C<Bootstrap> |
128
|
|
|
|
|
|
|
mechanism so a distribution can use files in its own source tree when building with itself. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This is very much like the C<Bootstrap::lib> plugin in that it injects libraries into |
131
|
|
|
|
|
|
|
C<@INC> based on your existing source tree, or a previous build you ran. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
And it is syntactically like the C<ShareDir> plugin. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
B<Note> that this is really only useful for self consuming I<plugins> and will have no effect |
136
|
|
|
|
|
|
|
on the C<test> or C<run> phases of your dist. ( For that, you'll need C<Test::File::ShareDir> ). |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 USAGE |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
[Bootstrap::lib] |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
[Bootstrap::ShareDir::Dist] |
143
|
|
|
|
|
|
|
dir = share |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
[ShareDir] |
146
|
|
|
|
|
|
|
dir = share |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
The only significant difference between this module and C<ShareDir> is this module exists to make C<share> visible to |
149
|
|
|
|
|
|
|
plugins for the distribution being built, while C<ShareDir> exists to export the C<share> directory visible after install time. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Additionally, there are two primary attributes that are provided by L<< C<Dist::Zilla::Role::Bootstrap>|Dist::Zilla::Role::Bootstrap >>, See L<< Dist::Zilla::Role::Bootstrap/ATTRIBUTES >> |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
For instance, this bootstraps C<ROOT/Your-Dist-Name-$VERSION/share> if it exists and there's only one C<$VERSION>, |
154
|
|
|
|
|
|
|
otherwise it falls back to simply bootstrapping C<ROOT/share> |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
[Bootstrap::ShareDir::Dist] |
157
|
|
|
|
|
|
|
dir = share |
158
|
|
|
|
|
|
|
try_built = 1 |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 METHODS |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head2 C<do_bootstrap_sharedir> |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
This is where all the real work is done. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head2 C<bootstrap> |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Called by L<<< C<< Dist::Zilla::Role::B<Bootstrap> >>|Dist::Zilla::Role::Bootstrap >>> |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head2 C<dir> |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=begin MetaPOD::JSON v1.1.0 |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
{ |
177
|
|
|
|
|
|
|
"namespace":"Dist::Zilla::Plugin::Bootstrap::ShareDir::Dist", |
178
|
|
|
|
|
|
|
"interface":"class", |
179
|
|
|
|
|
|
|
"does":"Dist::Zilla::Role::Bootstrap", |
180
|
|
|
|
|
|
|
"inherits":"Moose::Object" |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=end MetaPOD::JSON |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head1 AUTHOR |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Kent Fredric <kentnl@cpan.org> |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Kent Fredric <kentfredric@gmail.com>. |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
195
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=cut |