line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
1775200
|
use v5.10; |
|
1
|
|
|
|
|
5
|
|
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
60
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::Prereqs::Floor; |
6
|
|
|
|
|
|
|
# ABSTRACT: Dist::Zilla plugin to set a minimum allowed version for prerequisites |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.002'; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
5552
|
use Dist::Zilla 5; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
329
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::PrereqSource'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has _floor => ( |
17
|
|
|
|
|
|
|
is => 'ro', |
18
|
|
|
|
|
|
|
isa => 'HashRef', |
19
|
|
|
|
|
|
|
default => sub { {} }, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub BUILDARGS { |
23
|
1
|
|
|
1
|
1
|
4
|
my ( $class, @arg ) = @_; |
24
|
1
|
50
|
|
|
|
5
|
my %copy = ref $arg[0] ? %{ $arg[0] } : @arg; |
|
1
|
|
|
|
|
7
|
|
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
3
|
my $zilla = delete $copy{zilla}; |
27
|
1
|
|
|
|
|
3
|
my $name = delete $copy{plugin_name}; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
return { |
30
|
1
|
|
|
|
|
31
|
zilla => $zilla, |
31
|
|
|
|
|
|
|
plugin_name => $name, |
32
|
|
|
|
|
|
|
_floor => \%copy, |
33
|
|
|
|
|
|
|
}; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub register_prereqs { |
37
|
1
|
|
|
1
|
0
|
370030
|
my ($self) = @_; |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
|
|
8
|
$self->log("Checking module prerequisites against minimum floor"); |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
259
|
my $zilla = $self->zilla; |
42
|
1
|
|
|
|
|
35
|
my $floor = $self->_floor; |
43
|
|
|
|
|
|
|
|
44
|
1
|
50
|
|
|
|
4
|
return unless %$floor; |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
20
|
my $prereqs = $zilla->prereqs->cpan_meta_prereqs->as_string_hash; |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
577
|
foreach my $phase ( sort keys %$prereqs ) { |
49
|
3
|
|
|
|
|
5
|
foreach my $rel ( sort keys %{ $prereqs->{$phase} } ) { |
|
3
|
|
|
|
|
10
|
|
50
|
4
|
|
|
|
|
226
|
foreach my $mod ( sort keys %{ $prereqs->{$phase}{$rel} } ) { |
|
4
|
|
|
|
|
13
|
|
51
|
8
|
50
|
|
|
|
462
|
next if $mod eq 'perl'; # obvious |
52
|
8
|
100
|
|
|
|
24
|
if ( my $ver = $floor->{$mod} ) { |
53
|
4
|
|
|
|
|
23
|
$self->log_debug("$phase/$rel: $mod minimum set to $ver"); |
54
|
4
|
|
|
|
|
1086
|
$self->zilla->register_prereqs( |
55
|
|
|
|
|
|
|
{ |
56
|
|
|
|
|
|
|
phase => $phase, |
57
|
|
|
|
|
|
|
type => $rel, |
58
|
|
|
|
|
|
|
}, |
59
|
|
|
|
|
|
|
$mod => $ver, |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
1
|
|
|
|
|
221
|
return; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# vim: ts=4 sts=4 sw=4 et tw=75: |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
__END__ |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=pod |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=encoding UTF-8 |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 NAME |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Prereqs::Floor - Dist::Zilla plugin to set a minimum allowed version for prerequisites |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 VERSION |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
version 0.002 |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 SYNOPSIS |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
; in dist.ini |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
[Prereqs::Floor] |
93
|
|
|
|
|
|
|
File::Temp = 0.19 |
94
|
|
|
|
|
|
|
Test::More = 0.86 |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 DESCRIPTION |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This prereq provider sets a minimum allowed version for the specified |
99
|
|
|
|
|
|
|
modules. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
If the module has been listed as a prerequisite for any phase ('runtime', |
102
|
|
|
|
|
|
|
'test', etc.) or type ('requires', 'recommends', etc.), the listed minimum |
103
|
|
|
|
|
|
|
version will be applied to that phase and type. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
The prereqs will B<only> be applied if they already exist. This will not |
106
|
|
|
|
|
|
|
add any new prerequisites. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This prereq provider should run B<last>. Any prerequisites added after it |
109
|
|
|
|
|
|
|
runs won't be updated. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=for Pod::Coverage BUILDARGS register_prereqs mvp_multivalue_args |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 SEE ALSO |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=over 4 |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item * |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
L<Prereqs::Upgrade|Dist::Zilla::Plugin::Prereqs::Upgrade> â similar concept with very flexible phase and type mapping, but harder to apply universally across all phases/types at once |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=back |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 SUPPORT |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 Bugs / Feature Requests |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Please report any bugs or feature requests through the issue tracker |
130
|
|
|
|
|
|
|
at L<https://github.com/dagolden/Dist-Zilla-Plugin-Prereqs-Floor/issues>. |
131
|
|
|
|
|
|
|
You will be notified automatically of any progress on your issue. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head2 Source Code |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
This is open source software. The code repository is available for |
136
|
|
|
|
|
|
|
public review and contribution under the terms of the license. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
L<https://github.com/dagolden/Dist-Zilla-Plugin-Prereqs-Floor> |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
git clone https://github.com/dagolden/Dist-Zilla-Plugin-Prereqs-Floor.git |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 AUTHOR |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
David Golden <dagolden@cpan.org> |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 CONTRIBUTOR |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=for stopwords David Golden |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
David Golden <xdg@xdg.me> |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
This software is Copyright (c) 2015 by David Golden. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
This is free software, licensed under: |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
The Apache License, Version 2.0, January 2004 |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=cut |