| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
2
|
|
|
2
|
|
1445095
|
use 5.006; # our |
|
|
2
|
|
|
|
|
6
|
|
|
2
|
2
|
|
|
2
|
|
7
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
38
|
|
|
3
|
2
|
|
|
2
|
|
6
|
use warnings; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
127
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::Regenerate; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.001000'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Write contents to your source tree explicitly |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
|
12
|
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
468
|
use Moose qw( with has around ); |
|
|
2
|
|
|
|
|
298196
|
|
|
|
2
|
|
|
|
|
11
|
|
|
14
|
2
|
|
|
2
|
|
8570
|
use Beam::Event qw(); |
|
|
2
|
|
|
|
|
190345
|
|
|
|
2
|
|
|
|
|
55
|
|
|
15
|
2
|
|
|
2
|
|
883
|
use Beam::Emitter qw(); |
|
|
2
|
|
|
|
|
60647
|
|
|
|
2
|
|
|
|
|
64
|
|
|
16
|
2
|
|
|
2
|
|
894
|
use Path::Tiny 0.017 qw( path ); |
|
|
2
|
|
|
|
|
7613
|
|
|
|
2
|
|
|
|
|
110
|
|
|
17
|
2
|
|
|
2
|
|
427
|
use namespace::clean -except => 'meta'; |
|
|
2
|
|
|
|
|
4067
|
|
|
|
2
|
|
|
|
|
13
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
with qw/ Dist::Zilla::Role::Plugin Dist::Zilla::Role::Regenerator Beam::Emitter /; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has filenames => ( is => 'ro', isa => 'ArrayRef', default => sub { [] }, ); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
around dump_config => sub { |
|
24
|
|
|
|
|
|
|
my ( $orig, $self, @args ) = @_; |
|
25
|
|
|
|
|
|
|
my $config = $self->$orig(@args); |
|
26
|
|
|
|
|
|
|
my $payload = $config->{ +__PACKAGE__ } = {}; |
|
27
|
|
|
|
|
|
|
$payload->{filenames} = $self->filenames; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
## no critic (RequireInterpolationOfMetachars) |
|
30
|
|
|
|
|
|
|
# Self report when inherited |
|
31
|
|
|
|
|
|
|
$payload->{ q[$] . __PACKAGE__ . '::VERSION' } = $VERSION unless __PACKAGE__ eq ref $self; |
|
32
|
|
|
|
|
|
|
return $config; |
|
33
|
|
|
|
|
|
|
}; |
|
34
|
|
|
|
|
|
|
|
|
35
|
2
|
|
|
2
|
|
518
|
no Moose; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
16
|
|
|
36
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
|
42
|
1
|
|
|
1
|
0
|
193
|
sub mvp_multivalue_args { qw( filenames ) } |
|
43
|
1
|
|
|
1
|
0
|
137
|
sub mvp_aliases { +{ filename => 'filenames' } } |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub regenerate { |
|
46
|
1
|
|
|
1
|
0
|
42
|
my ( $self, $config ) = @_; |
|
47
|
1
|
|
|
|
|
3
|
$self->emit( 'before_regenerate', class => 'Dist::Zilla::Event::Regenerate::BeforeRegenerate', %{$config} ); |
|
|
1
|
|
|
|
|
7
|
|
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# Note, that because dzil is build -> dir -> archive -> release |
|
50
|
|
|
|
|
|
|
# regenerate has to pick files from the "dir" target on disk, and can't go through |
|
51
|
|
|
|
|
|
|
# dzil IO |
|
52
|
1
|
|
|
|
|
1
|
for my $file ( @{ $self->filenames } ) { |
|
|
1
|
|
|
|
|
29
|
|
|
53
|
1
|
|
|
|
|
4
|
my $src = path( $config->{build_root}, $file ); |
|
54
|
1
|
|
|
|
|
28
|
my $dest = path( $config->{root}, $file ); |
|
55
|
1
|
|
|
|
|
17
|
$src->copy($dest); |
|
56
|
1
|
|
|
|
|
309
|
$self->log("Copied $src to $dest"); |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
1
|
|
|
|
|
432
|
$self->emit( 'after_regenerate', class => 'Dist::Zilla::Event::Regenerate::AfterRegenerate', %{$config} ); |
|
|
1
|
|
|
|
|
4
|
|
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
{ |
|
63
|
|
|
|
|
|
|
package # Hide |
|
64
|
|
|
|
|
|
|
Dist::Zilla::Event::Regenerate::BeforeRegenerate; |
|
65
|
2
|
|
|
2
|
|
486
|
use Moose qw( has extends ); |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
11
|
|
|
66
|
|
|
|
|
|
|
extends q/Beam::Event/; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
has 'build_root' => ( isa => 'Str', is => 'ro', required => 1 ); |
|
69
|
|
|
|
|
|
|
has 'root' => ( isa => 'Str', is => 'ro', required => 1 ); |
|
70
|
2
|
|
|
2
|
|
7502
|
no Moose; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
7
|
|
|
71
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
{ |
|
74
|
|
|
|
|
|
|
package # Hide |
|
75
|
|
|
|
|
|
|
Dist::Zilla::Event::Regenerate::AfterRegenerate; |
|
76
|
2
|
|
|
2
|
|
203
|
use Moose qw( has extends ); |
|
|
2
|
|
|
|
|
18
|
|
|
|
2
|
|
|
|
|
8
|
|
|
77
|
|
|
|
|
|
|
extends q/Beam::Event/; |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
has 'build_root' => ( isa => 'Str', is => 'ro', required => 1 ); |
|
80
|
|
|
|
|
|
|
has 'root' => ( isa => 'Str', is => 'ro', required => 1 ); |
|
81
|
2
|
|
|
2
|
|
6212
|
no Moose; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
7
|
|
|
82
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
__END__ |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=pod |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=encoding UTF-8 |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 NAME |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Regenerate - Write contents to your source tree explicitly |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 VERSION |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
version 0.001000 |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
B<in C<dist.ini>> |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
[Regenerate] |
|
106
|
|
|
|
|
|
|
; For example |
|
107
|
|
|
|
|
|
|
filenames = Makefile.PL |
|
108
|
|
|
|
|
|
|
filenames = META.json |
|
109
|
|
|
|
|
|
|
filenames = README.mkdn |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
B<on your command line> |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
dzil regenerate |
|
114
|
|
|
|
|
|
|
# Makefile.PL updated |
|
115
|
|
|
|
|
|
|
# META.json updated |
|
116
|
|
|
|
|
|
|
# ... |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
This plugin, in conjunction with the L<< C<dzil regenerate>|Dist::Zilla::App::Command::regenerate >> |
|
121
|
|
|
|
|
|
|
command, allows turn-key copying of content from your build tree to your source tree. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This is a compatriot of L<< C<[CopyFilesFromBuild]>|Dist::Zilla::Plugin::CopyFilesFromBuild >> and |
|
124
|
|
|
|
|
|
|
L<< C<[CopyFilesFromRelease]>|Dist::Zilla::Plugin::CopyFilesFromRelease >>, albeit targeted to happen |
|
125
|
|
|
|
|
|
|
outside your standard work phase, allowing you to copy generated files back into the source tree on demand, |
|
126
|
|
|
|
|
|
|
and also freeing you from them being updated when you don't require it. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=for Pod::Coverage mvp_multivalue_args mvp_aliases regenerate |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 C<filenames> |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
An Array of Strings describing files to copy. |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
[Regenerate] |
|
137
|
|
|
|
|
|
|
filename = Makefile.PL |
|
138
|
|
|
|
|
|
|
filename = META.json |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
B<aliases:> C<filename> |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=over 4 |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=item * L<< C<[CopyFilesFromBuild]>|Dist::Zilla::Plugin::CopyFilesFromBuild >> |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
This plugin operates only on the C<AfterBuild> phase, and thus will modify files on every |
|
149
|
|
|
|
|
|
|
C<dzil build>, creating undesired work-flow churn. |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=item * L<< C<[CopyFilesFromRelease]>|Dist::Zilla::Plugin::CopyFilesFromRelease >> |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
This plugin operates only on the C<AfterRelease> phase, impeding work-flow slightly |
|
154
|
|
|
|
|
|
|
for people who B<WANT> to update their source tree without actually doing a release. |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
This plugin can be used instead of C<[Regenerate]> though, by using it in conjunction |
|
157
|
|
|
|
|
|
|
with L<< C<[Regenerate::AfterReleasers]>|Dist::Zilla::Plugin::Regenerate::AfterReleasers >> |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=back |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 AUTHOR |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Kent Fredric <kentnl@cpan.org> |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
This software is copyright (c) 2016 by Kent Fredric <kentfredric@gmail.com>. |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
170
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=cut |