line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
3056206
|
use 5.008; |
|
1
|
|
|
|
|
4
|
|
2
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
113
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::InstallGuide; # git description: v1.200012-7-g19b74b1 |
6
|
|
|
|
|
|
|
# ABSTRACT: Build an INSTALL file |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.200013'; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
8
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
11
|
|
11
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::FileGatherer'; |
12
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::TextTemplate'; |
13
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::FileMunger'; |
14
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::ModuleMetadata'; |
15
|
1
|
|
|
1
|
|
7111
|
use List::Util 1.33 qw(first any); |
|
1
|
|
|
|
|
27
|
|
|
1
|
|
|
|
|
94
|
|
16
|
1
|
|
|
1
|
|
9
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
11
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
19
|
|
|
|
|
|
|
#pod |
20
|
|
|
|
|
|
|
#pod In C<dist.ini>: |
21
|
|
|
|
|
|
|
#pod |
22
|
|
|
|
|
|
|
#pod [InstallGuide] |
23
|
|
|
|
|
|
|
#pod |
24
|
|
|
|
|
|
|
#pod =begin :prelude |
25
|
|
|
|
|
|
|
#pod |
26
|
|
|
|
|
|
|
#pod =for test_synopsis BEGIN { die "SKIP: synopsis isn't perl code" } |
27
|
|
|
|
|
|
|
#pod |
28
|
|
|
|
|
|
|
#pod =end :prelude |
29
|
|
|
|
|
|
|
#pod |
30
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
31
|
|
|
|
|
|
|
#pod |
32
|
|
|
|
|
|
|
#pod This plugin adds a very simple F<INSTALL> file to the distribution, telling |
33
|
|
|
|
|
|
|
#pod the user how to install this distribution. |
34
|
|
|
|
|
|
|
#pod |
35
|
|
|
|
|
|
|
#pod You should use this plugin in your L<Dist::Zilla> configuration after |
36
|
|
|
|
|
|
|
#pod C<[MakeMaker]> or C<[ModuleBuild]> so that it can determine what kind of |
37
|
|
|
|
|
|
|
#pod distribution you are building and which installation instructions are |
38
|
|
|
|
|
|
|
#pod appropriate. |
39
|
|
|
|
|
|
|
#pod |
40
|
|
|
|
|
|
|
#pod =head1 METHODS |
41
|
|
|
|
|
|
|
#pod |
42
|
|
|
|
|
|
|
#pod =cut |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has template => (is => 'ro', isa => 'Str', default => <<'END_TEXT'); |
45
|
|
|
|
|
|
|
This is the Perl distribution {{ $dist->name }}. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Installing {{ $dist->name }} is straightforward. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
## Installation with cpanm |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
If you have cpanm, you only need one line: |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
% cpanm {{ $package }} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
If it does not have permission to install modules to the current perl, cpanm |
56
|
|
|
|
|
|
|
will automatically set up and install to a local::lib in your home directory. |
57
|
|
|
|
|
|
|
See the local::lib documentation (https://metacpan.org/pod/local::lib) for |
58
|
|
|
|
|
|
|
details on enabling it in your environment. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
## Installing with the CPAN shell |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Alternatively, if your CPAN shell is set up, you should just be able to do: |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
% cpan {{ $package }} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
## Manual installation |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
{{ $manual_installation }} |
69
|
|
|
|
|
|
|
The prerequisites of this distribution will also have to be installed manually. The |
70
|
|
|
|
|
|
|
prerequisites are listed in one of the files: `MYMETA.yml` or `MYMETA.json` generated |
71
|
|
|
|
|
|
|
by running the manual build process described above. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
## Configure Prerequisites |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This distribution requires other modules to be installed before this |
76
|
|
|
|
|
|
|
distribution's installer can be run. They can be found under the |
77
|
|
|
|
|
|
|
{{ join(" or the\n", |
78
|
|
|
|
|
|
|
$has_meta_yml ? '"configure_requires" key of META.yml' : '', |
79
|
|
|
|
|
|
|
$has_meta_json ? '"{prereqs}{configure}{requires}" key of META.json' : '', |
80
|
|
|
|
|
|
|
)}}. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
## Other Prerequisites |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
This distribution may require additional modules to be installed after running |
85
|
|
|
|
|
|
|
{{ join(' or ', grep { $installer{$_} } qw(Build.PL Makefile.PL)) }}. |
86
|
|
|
|
|
|
|
Look for prerequisites in the following phases: |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
* to run {{ join(' or ', |
89
|
|
|
|
|
|
|
($installer{'Build.PL'} ? './Build' : ()), |
90
|
|
|
|
|
|
|
($installer{'Makefile.PL'} ? 'make' : ())) }}, PHASE = build |
91
|
|
|
|
|
|
|
* to use the module code itself, PHASE = runtime |
92
|
|
|
|
|
|
|
* to run tests, PHASE = test |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
They can all be found in the {{ join(" or the\n", |
95
|
|
|
|
|
|
|
$has_meta_yml ? '"PHASE_requires" key of MYMETA.yml' : '', |
96
|
|
|
|
|
|
|
$has_meta_json ? '"{prereqs}{PHASE}{requires}" key of MYMETA.json' : '', |
97
|
|
|
|
|
|
|
)}}. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
## Documentation |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
{{ $dist->name }} documentation is available as POD. |
102
|
|
|
|
|
|
|
You can run `perldoc` from a shell to read the documentation: |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
% perldoc {{ $package }} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
For more information on installing Perl modules via CPAN, please see: |
107
|
|
|
|
|
|
|
https://www.cpan.org/modules/INSTALL.html |
108
|
|
|
|
|
|
|
END_TEXT |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
our $common_instructions = <<'END_TEXT'; |
111
|
|
|
|
|
|
|
As a last resort, you can manually install it. Download the tarball, untar it, |
112
|
|
|
|
|
|
|
install configure prerequisites (see below), then build it: |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
END_TEXT |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
has makemaker_manual_installation => ( |
117
|
|
|
|
|
|
|
is => 'ro', isa => 'Str', |
118
|
|
|
|
|
|
|
default => $common_instructions . <<'END_TEXT', |
119
|
|
|
|
|
|
|
% perl Makefile.PL |
120
|
|
|
|
|
|
|
% make && make test |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Then install it: |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
% make install |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
On Windows platforms, you should use `dmake` or `nmake`, instead of `make`. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
If your perl is system-managed, you can create a local::lib in your home |
129
|
|
|
|
|
|
|
directory to install modules to. For details, see the local::lib documentation: |
130
|
|
|
|
|
|
|
https://metacpan.org/pod/local::lib |
131
|
|
|
|
|
|
|
END_TEXT |
132
|
|
|
|
|
|
|
); |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
has module_build_manual_installation => ( |
135
|
|
|
|
|
|
|
is => 'ro', isa => 'Str', |
136
|
|
|
|
|
|
|
default => $common_instructions . <<'END_TEXT', |
137
|
|
|
|
|
|
|
% perl Build.PL |
138
|
|
|
|
|
|
|
% ./Build && ./Build test |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Then install it: |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
% ./Build install |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Or the more portable variation: |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
% perl Build.PL |
147
|
|
|
|
|
|
|
% perl Build |
148
|
|
|
|
|
|
|
% perl Build test |
149
|
|
|
|
|
|
|
% perl Build install |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
If your perl is system-managed, you can create a local::lib in your home |
152
|
|
|
|
|
|
|
directory to install modules to. For details, see the local::lib documentation: |
153
|
|
|
|
|
|
|
https://metacpan.org/pod/local::lib |
154
|
|
|
|
|
|
|
END_TEXT |
155
|
|
|
|
|
|
|
); |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
#pod =head2 gather_files |
158
|
|
|
|
|
|
|
#pod |
159
|
|
|
|
|
|
|
#pod Creates the F<INSTALL> file. |
160
|
|
|
|
|
|
|
#pod |
161
|
|
|
|
|
|
|
#pod =cut |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
sub gather_files { |
164
|
1
|
|
|
1
|
1
|
80391
|
my $self = shift; |
165
|
|
|
|
|
|
|
|
166
|
1
|
|
|
|
|
8
|
require Dist::Zilla::File::InMemory; |
167
|
1
|
|
|
|
|
37
|
$self->add_file(Dist::Zilla::File::InMemory->new({ |
168
|
|
|
|
|
|
|
name => 'INSTALL', |
169
|
|
|
|
|
|
|
content => $self->template, |
170
|
|
|
|
|
|
|
})); |
171
|
|
|
|
|
|
|
|
172
|
1
|
|
|
|
|
945
|
return; |
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
#pod =head2 munge_files |
176
|
|
|
|
|
|
|
#pod |
177
|
|
|
|
|
|
|
#pod Inserts the appropriate installation instructions into F<INSTALL>. |
178
|
|
|
|
|
|
|
#pod |
179
|
|
|
|
|
|
|
#pod =cut |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
sub munge_files { |
182
|
1
|
|
|
1
|
1
|
4450
|
my $self = shift; |
183
|
|
|
|
|
|
|
|
184
|
1
|
|
|
|
|
36
|
my $zilla = $self->zilla; |
185
|
|
|
|
|
|
|
|
186
|
1
|
|
|
|
|
17
|
my $manual_installation = ''; |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
my %installer = ( |
189
|
|
|
|
|
|
|
map { |
190
|
14
|
100
|
|
|
|
1048
|
$_->isa('Dist::Zilla::Plugin::MakeMaker') ? ( 'Makefile.PL' => 1 ) : (), |
|
|
50
|
|
|
|
|
|
191
|
|
|
|
|
|
|
$_->does('Dist::Zilla::Role::BuildPL') ? ( 'Build.PL' => 1 ) : (), |
192
|
1
|
|
|
|
|
4
|
} @{ $zilla->plugins } |
|
1
|
|
|
|
|
23
|
|
193
|
|
|
|
|
|
|
); |
194
|
|
|
|
|
|
|
|
195
|
1
|
50
|
|
|
|
53
|
if ($installer{'Build.PL'}) { |
|
|
50
|
|
|
|
|
|
196
|
0
|
|
|
|
|
0
|
$manual_installation .= $self->module_build_manual_installation; |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
elsif ($installer{'Makefile.PL'}) { |
199
|
1
|
|
|
|
|
48
|
$manual_installation .= $self->makemaker_manual_installation; |
200
|
|
|
|
|
|
|
} |
201
|
1
|
50
|
|
|
|
4
|
unless ($manual_installation) { |
202
|
0
|
|
|
|
|
0
|
$self->log_fatal('neither Makefile.PL nor Build.PL is present, aborting'); |
203
|
|
|
|
|
|
|
} |
204
|
|
|
|
|
|
|
|
205
|
1
|
|
|
|
|
33
|
my $main_package = $self->module_metadata_for_file($zilla->main_module, collect_pod => 0)->name; |
206
|
|
|
|
|
|
|
|
207
|
1
|
|
|
4
|
|
5871
|
my $file = first { $_->name eq 'INSTALL' } @{ $zilla->files }; |
|
4
|
|
|
|
|
159
|
|
|
1
|
|
|
|
|
31
|
|
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
my $content = $self->fill_in_string( |
210
|
|
|
|
|
|
|
$file->content, |
211
|
|
|
|
|
|
|
{ dist => \$zilla, |
212
|
|
|
|
|
|
|
package => $main_package, |
213
|
|
|
|
|
|
|
manual_installation => $manual_installation, |
214
|
4
|
|
|
4
|
|
152
|
has_meta_yml => (any { $_->name eq 'META.yml' } @{ $zilla->files }), |
|
1
|
|
|
|
|
109
|
|
215
|
1
|
|
|
4
|
|
50
|
has_meta_json => (any { $_->name eq 'META.json' } @{ $zilla->files }), |
|
4
|
|
|
|
|
137
|
|
|
1
|
|
|
|
|
74
|
|
216
|
|
|
|
|
|
|
installer => \%installer, |
217
|
|
|
|
|
|
|
} |
218
|
|
|
|
|
|
|
); |
219
|
|
|
|
|
|
|
|
220
|
1
|
|
|
|
|
3494
|
$file->content($content); |
221
|
1
|
|
|
|
|
283
|
return; |
222
|
|
|
|
|
|
|
} |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
225
|
1
|
|
|
1
|
|
621
|
no Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
226
|
|
|
|
|
|
|
1; |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
__END__ |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=pod |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=encoding UTF-8 |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=head1 NAME |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
Dist::Zilla::Plugin::InstallGuide - Build an INSTALL file |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=head1 VERSION |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
version 1.200013 |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=for test_synopsis BEGIN { die "SKIP: synopsis isn't perl code" } |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=head1 SYNOPSIS |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
In C<dist.ini>: |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
[InstallGuide] |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=head1 DESCRIPTION |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
This plugin adds a very simple F<INSTALL> file to the distribution, telling |
253
|
|
|
|
|
|
|
the user how to install this distribution. |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
You should use this plugin in your L<Dist::Zilla> configuration after |
256
|
|
|
|
|
|
|
C<[MakeMaker]> or C<[ModuleBuild]> so that it can determine what kind of |
257
|
|
|
|
|
|
|
distribution you are building and which installation instructions are |
258
|
|
|
|
|
|
|
appropriate. |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=head1 METHODS |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=head2 gather_files |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
Creates the F<INSTALL> file. |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
=head2 munge_files |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
Inserts the appropriate installation instructions into F<INSTALL>. |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
=head1 SUPPORT |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Plugin-InstallGuide> |
273
|
|
|
|
|
|
|
(or L<bug-Dist-Zilla-Plugin-InstallGuide@rt.cpan.org|mailto:bug-Dist-Zilla-Plugin-InstallGuide@rt.cpan.org>). |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
There is also a mailing list available for users of this distribution, at |
276
|
|
|
|
|
|
|
L<http://dzil.org/#mailing-list>. |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
There is also an irc channel available for users of this distribution, at |
279
|
|
|
|
|
|
|
L<C<#distzilla> on C<irc.perl.org>|irc://irc.perl.org/#distzilla>. |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=head1 AUTHORS |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
=over 4 |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=item * |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
Marcel Grünauer <marcel@cpan.org> |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=item * |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
Mike Doherty <doherty@cpan.org> |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=back |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
=for stopwords Karen Etheridge Mike Doherty Marcel Gruenauer jonasbn Dan Book Dave Rolsky Apocalypse |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=over 4 |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=item * |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
Karen Etheridge <ether@cpan.org> |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
=item * |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
Mike Doherty <mike@mikedoherty.ca> |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
=item * |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
Marcel Gruenauer <hanekomu@gmail.com> |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
=item * |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
jonasbn <jonasbn@gmail.com> |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
=item * |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
Mike Doherty <doherty@cs.dal.ca> |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
=item * |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
Dan Book <grinnz@gmail.com> |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
=item * |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
=item * |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
Apocalypse <APOCAL@cpan.org> |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
=back |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
This software is copyright (c) 2010 by Marcel Grünauer <marcel@cpan.org>. |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
340
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
=cut |