line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::SchwartzRatio; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:YANICK'; |
3
|
|
|
|
|
|
|
# ABSTRACT: display the Schwartz ratio of the distribution upon release |
4
|
|
|
|
|
|
|
$Dist::Zilla::Plugin::SchwartzRatio::VERSION = '0.3.2'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
80333
|
use 5.14.0; |
|
1
|
|
|
|
|
3
|
|
7
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
16
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
411
|
use List::UtilsBy qw/ sort_by /; |
|
1
|
|
|
|
|
1165
|
|
|
1
|
|
|
|
|
51
|
|
11
|
1
|
|
|
1
|
|
393
|
use MetaCPAN::Client; |
|
1
|
|
|
|
|
274420
|
|
|
1
|
|
|
|
|
27
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
429
|
use Moose; |
|
1
|
|
|
|
|
418777
|
|
|
1
|
|
|
|
|
6
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
with qw/ |
16
|
|
|
|
|
|
|
Dist::Zilla::Role::Plugin |
17
|
|
|
|
|
|
|
Dist::Zilla::Role::AfterRelease |
18
|
|
|
|
|
|
|
/; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has mcpan => ( |
21
|
|
|
|
|
|
|
is => 'ro', |
22
|
|
|
|
|
|
|
lazy => 1, |
23
|
|
|
|
|
|
|
default => sub { MetaCPAN::Client->new }, |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has releases => ( |
27
|
|
|
|
|
|
|
is => 'ro', |
28
|
|
|
|
|
|
|
traits => [ 'Array' ], |
29
|
|
|
|
|
|
|
handles => { |
30
|
|
|
|
|
|
|
all_releases => 'elements', |
31
|
|
|
|
|
|
|
nbr_releases => 'count', |
32
|
|
|
|
|
|
|
}, |
33
|
|
|
|
|
|
|
lazy => 1, |
34
|
|
|
|
|
|
|
default => sub { |
35
|
|
|
|
|
|
|
my $self = shift; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $releases = $self->mcpan->release({ |
38
|
|
|
|
|
|
|
distribution => $self->zilla->name |
39
|
|
|
|
|
|
|
}); |
40
|
|
|
|
|
|
|
my @releases; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
while( my $r = $releases->next ) { |
43
|
|
|
|
|
|
|
my( $version, $date ) = map { $r->$_ } qw/ version date /; |
44
|
|
|
|
|
|
|
$date =~ s/T.*//; |
45
|
|
|
|
|
|
|
push @releases, [ 'v'.$version, $date ]; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
return [ sort_by { $_->[1] } @releases ]; |
49
|
|
|
|
|
|
|
}, |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub after_release { |
53
|
1
|
|
|
1
|
0
|
173335
|
my $self = shift; |
54
|
|
|
|
|
|
|
|
55
|
1
|
|
|
|
|
50
|
$self->log( $self->nbr_releases . " old releases are lingering on CPAN" ); |
56
|
1
|
|
|
|
|
375
|
$self->log( "\t" . join ', ', @$_ ) for $self->all_releases; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=pod |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=encoding UTF-8 |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 NAME |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Dist::Zilla::Plugin::SchwartzRatio - display the Schwartz ratio of the distribution upon release |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 VERSION |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
version 0.3.2 |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 SYNOPSIS |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
In dist.ini: |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
[SchwartzRatio] |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 DESCRIPTION |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
The Schwartz Ratio of CPAN is the number of number of latest |
86
|
|
|
|
|
|
|
releases over the total number of releases that CPAN has. For |
87
|
|
|
|
|
|
|
a single distribution, it boils down to the less exciting |
88
|
|
|
|
|
|
|
number of previous releases still on CPAN. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
After a successful release, the plugin displays |
91
|
|
|
|
|
|
|
the releases of the distribution still kicking around on CPAN, |
92
|
|
|
|
|
|
|
just to give an idea to the author that maybe it's time |
93
|
|
|
|
|
|
|
to do some cleanup. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 SEE ALSO |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=over |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item L<App-PAUSE-cleanup|https://metacpan.org/release/App-PAUSE-cleanup> |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
CLI utility to list and help you delete easily your distributions on CPAN. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=back |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 AUTHOR |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Yanick Champoux <yanick@cpan.org> |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
This software is copyright (c) 2012 by Yanick Champoux. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
114
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=cut |