line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::CopyReadmeFromBuild; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
1
|
|
|
1
|
|
168582
|
$Dist::Zilla::Plugin::CopyReadmeFromBuild::VERSION = '0.0019'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
# ABSTRACT: Copy README after building (for SCM inclusion, etc.) |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
273776
|
use Moose; |
|
1
|
|
|
|
|
973351
|
|
|
1
|
|
|
|
|
8
|
|
9
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::AfterBuild'; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
7946
|
use File::Copy qw/ copy /; |
|
1
|
|
|
|
|
2198
|
|
|
1
|
|
|
|
|
213
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub after_build { |
14
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
15
|
0
|
|
|
|
|
|
my $data = shift; |
16
|
|
|
|
|
|
|
|
17
|
0
|
0
|
0
|
|
|
|
if ( $ENV{ DZIL_RELEASING} || $ENV{ DZIL_CopyFromBuildAfterBuild } ) {} |
18
|
0
|
|
|
|
|
|
else { return } |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my $build_root = $data->{build_root}; |
21
|
0
|
|
|
|
|
|
my $src; |
22
|
0
|
|
|
|
|
|
for(qw/ README README.md README.mkdn README.txt README.markdown /) { |
23
|
0
|
|
|
|
|
|
my $file = $build_root->file( $_ ); |
24
|
0
|
0
|
0
|
|
|
|
$src = $file and last if -e $file; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
|
die "Missing README file in ", $build_root unless $src; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $dest = $self->zilla->root->file( $src->basename ); |
30
|
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
copy "$src", "$dest" or die "Unable to copy $src to $dest: $!"; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
35
|
1
|
|
|
1
|
|
10
|
no Moose; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |
39
|
|
|
|
|
|
|
=pod |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 NAME |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Dist::Zilla::Plugin::CopyReadmeFromBuild - Copy README after building (for SCM inclusion, etc.) |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 VERSION |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
version 0.0019 |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 SYNOPSIS |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
In your L<Dist::Zilla> C<dist.ini>: |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
[CopyReadmeFromBuild] |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 DESCRIPTION |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
CopyReadmeFromBuild will automatically copy the README from the build directory |
58
|
|
|
|
|
|
|
into the distribution directory. This is so you can commit the README to version |
59
|
|
|
|
|
|
|
control. GitHub, for example, likes to see a README |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Readme will not like it if you already have a README, so |
62
|
|
|
|
|
|
|
you'll have to disable that plugin, an example of which is: |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
[@Filter] |
65
|
|
|
|
|
|
|
bundle = @Basic |
66
|
|
|
|
|
|
|
remove = Readme |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 AfterBuild/AfterRelease |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
With the release of 0.0016, this plugin changed to performing the copy during the AfterRelease stage instead of the AfterBuild stage. |
71
|
|
|
|
|
|
|
To enable the old behavior, set the environment variable DZIL_CopyFromBuildAfterBuild to 1: |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
$ DZIL_CopyFromBuildAfterBuild=1 dzil build |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 AUTHOR |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Robert Krimen <robertkrimen@gmail.com> |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
This software is copyright (c) 2011 by Robert Krimen. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
84
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=cut |
87
|
|
|
|
|
|
|
|