| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package ShipIt::Step::Readme; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
91475
|
use strict; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
114
|
|
|
4
|
3
|
|
|
3
|
|
3075
|
use Pod::Readme; |
|
|
3
|
|
|
|
|
221243
|
|
|
|
3
|
|
|
|
|
185
|
|
|
5
|
3
|
|
|
3
|
|
3532
|
use ShipIt::Util qw(slurp write_file); |
|
|
3
|
|
|
|
|
113873
|
|
|
|
3
|
|
|
|
|
757
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
65
|
use base 'ShipIt::Step'; |
|
|
3
|
|
|
|
|
11
|
|
|
|
3
|
|
|
|
|
3656
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
|
10
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
################################################################################ |
|
13
|
|
|
|
|
|
|
# no check for dry run, because we quit anyway if we encounter an |
|
14
|
|
|
|
|
|
|
# INSTALL / INSTALLATION section in Pod |
|
15
|
|
|
|
|
|
|
sub run { |
|
16
|
0
|
|
|
0
|
1
|
0
|
my ($self, $state) = @_; |
|
17
|
0
|
|
|
|
|
0
|
$state->pt->current_version; #should create $self->{ver_from} for us |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# change Distribution Module |
|
20
|
0
|
|
|
|
|
0
|
my $dist_file = $state->pt->{ver_from}; |
|
21
|
0
|
0
|
|
|
|
0
|
die "no file for distribution found", $self->{ver_from} unless ($dist_file); |
|
22
|
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
0
|
my $dist_content = slurp($dist_file); |
|
24
|
0
|
0
|
|
|
|
0
|
if ($dist_content !~ /^=head1 INSTALL/mi) { |
|
25
|
0
|
|
|
|
|
0
|
$dist_content = $self->_add_install_instructions($dist_content); |
|
26
|
0
|
|
|
|
|
0
|
write_file($dist_file, $dist_content); |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
0
|
my $parser = Pod::Readme->new(); |
|
30
|
0
|
|
|
|
|
0
|
$parser->parse_from_file($dist_file, 'README'); |
|
31
|
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
0
|
return 1; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
################################################################################ |
|
36
|
|
|
|
|
|
|
# put into extra sub made testing easier |
|
37
|
|
|
|
|
|
|
sub _add_install_instructions { |
|
38
|
3
|
|
|
3
|
|
1182
|
my ($self, $dist_content) = @_; |
|
39
|
3
|
|
|
|
|
14
|
my $install = $self->_get_instructions; |
|
40
|
3
|
100
|
|
|
|
27
|
return $dist_content if ($dist_content =~ s/(^=head\d VERSION.*?(?=^=))/$1$install/sm); |
|
41
|
2
|
100
|
|
|
|
26
|
return $dist_content if ($dist_content =~ s/(^=head\d NAME.*?(?=^=))/$1$install/sm); |
|
42
|
1
|
|
|
|
|
16
|
die ('trying to add pod Install section after VERSION or NAME Section, but there is none'); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
################################################################################ |
|
46
|
|
|
|
|
|
|
sub _build_instructions () {q~ |
|
47
|
|
|
|
|
|
|
perl Build.PL |
|
48
|
|
|
|
|
|
|
./Build |
|
49
|
|
|
|
|
|
|
./Build test |
|
50
|
|
|
|
|
|
|
./Build install |
|
51
|
|
|
|
|
|
|
~;} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
################################################################################ |
|
54
|
|
|
|
|
|
|
sub _make_instructions () {q~ |
|
55
|
|
|
|
|
|
|
perl Makefile.PL |
|
56
|
|
|
|
|
|
|
make |
|
57
|
|
|
|
|
|
|
make test |
|
58
|
|
|
|
|
|
|
make install |
|
59
|
|
|
|
|
|
|
~;} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
################################################################################ |
|
62
|
|
|
|
|
|
|
sub _get_instructions { |
|
63
|
3
|
|
|
3
|
|
5
|
my ($self) = @_; |
|
64
|
3
|
|
|
|
|
4
|
my $instructions; |
|
65
|
3
|
50
|
|
|
|
56
|
if (-e 'Build.PL') { |
|
|
|
0
|
|
|
|
|
|
|
66
|
3
|
|
|
|
|
13
|
$instructions = $self->_build_instructions ; |
|
67
|
|
|
|
|
|
|
} elsif (-e 'Makefile.PL') { |
|
68
|
0
|
|
|
|
|
0
|
$instructions = $self->_make_instructions; |
|
69
|
|
|
|
|
|
|
} else { |
|
70
|
0
|
|
|
|
|
0
|
die ('only Build.PL and Makefile.PL are supported, but none was found'); |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# little bit awkward, but Pod-Parsers don't check for Pod inside strings |
|
74
|
3
|
|
|
|
|
7
|
my $pod = "=begin readme\n\n"; |
|
75
|
3
|
|
|
|
|
7
|
$pod .= "=head1 INSTALLATION\n\n"; |
|
76
|
3
|
|
|
|
|
6
|
$pod .= "To install this module, run the following commands:\n"; |
|
77
|
3
|
|
|
|
|
8
|
$pod .= "$instructions\n"; |
|
78
|
3
|
|
|
|
|
5
|
$pod .= "=end readme\n\n"; |
|
79
|
|
|
|
|
|
|
|
|
80
|
3
|
|
|
|
|
7
|
return $pod; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 NAME |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
ShipIt::Step::Readme - Automatically create README for your Perl Package before releasing |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 VERSION |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Version 0.03 |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=begin readme |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 INSTALLATION |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
To install this module, run the following commands: |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
perl Build.PL |
|
100
|
|
|
|
|
|
|
./Build |
|
101
|
|
|
|
|
|
|
./Build test |
|
102
|
|
|
|
|
|
|
./Build install |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=end readme |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Just add it to the ShipIt config, after all steps, that edit Pod, because |
|
109
|
|
|
|
|
|
|
the README file is generated from the Pod of the distris' main file. |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
steps = FindVersion, ChangeVersion, ChangePodVersion, Readme, ... |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
And make sure you have a VERSION or a NAME section in your Pod. The README pod, |
|
114
|
|
|
|
|
|
|
which is not visible on CPAN, is added after any of them. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
This ShipIt::Step autogenerates a README-file from your distris' main package. |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Therefore it adds a Pod INSTALLATION section, but only if it does not exist yet. |
|
121
|
|
|
|
|
|
|
It contains installation instructions, for either an installation via ./Build or |
|
122
|
|
|
|
|
|
|
an installation via make, depending on the existence of a Build.PL or a |
|
123
|
|
|
|
|
|
|
Makefile.PL. If neither is found, we die. |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
The Pod INSTALLATION section is added after the Pod VERSION section, or in case |
|
126
|
|
|
|
|
|
|
it does not exist, after the Pod NAME section. If neither is found, we die. |
|
127
|
|
|
|
|
|
|
This section won't be visible on CPAN, and will only appear in your README. |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
B For example |
|
130
|
|
|
|
|
|
|
L does that to add a Pod VERSION section |
|
131
|
|
|
|
|
|
|
to your module. Otherwise the changes made won't be reflected in your README. |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 CONFIG |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Nothing to configure. Drop me an EMail if you have any wishes for configuration. |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 WARNING |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
This is not really tested with distris, which dont't use Build.PL. But from |
|
140
|
|
|
|
|
|
|
a logic point of view, there shouldn't be any problem. However, contact me if |
|
141
|
|
|
|
|
|
|
you encounter any problems. |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 AUTHOR |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Thomas Mueller, C<< >> |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 BUGS |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
|
150
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
|
151
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 SUPPORT |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
perldoc ShipIt::Step::Readme |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
You can also look for information at: |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=over 4 |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
L |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
L |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
L |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=item * Search CPAN |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
L |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=back |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
Copyright 2010 Thomas Mueller. |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
187
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
|
188
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=cut |