line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::PreviousVersion::Changelog; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:YANICK'; |
3
|
|
|
|
|
|
|
# ABSTRACT: extract previous version from changelog |
4
|
|
|
|
|
|
|
$Dist::Zilla::Plugin::PreviousVersion::Changelog::VERSION = '0.2.6'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
2908907
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
7
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
463
|
use CPAN::Changes; |
|
1
|
|
|
|
|
6880
|
|
|
1
|
|
|
|
|
31
|
|
10
|
1
|
|
|
1
|
|
7
|
use List::Util qw/ first /; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
57
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
7
|
use Moose; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
with qw/ |
15
|
|
|
|
|
|
|
Dist::Zilla::Role::Plugin |
16
|
|
|
|
|
|
|
Dist::Zilla::Role::YANICK::PreviousVersionProvider |
17
|
|
|
|
|
|
|
/; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has filename => ( is => 'ro', isa=>'Str', default => 'Changes' ); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has changelog => ( |
22
|
|
|
|
|
|
|
is => 'ro', |
23
|
|
|
|
|
|
|
isa => 'CPAN::Changes', |
24
|
|
|
|
|
|
|
lazy => 1, |
25
|
|
|
|
|
|
|
default => sub { |
26
|
|
|
|
|
|
|
my $self = shift; |
27
|
|
|
|
|
|
|
my $changes_file = first { $_->name eq $self->filename } |
28
|
|
|
|
|
|
|
@{ $self->zilla->files } |
29
|
|
|
|
|
|
|
or $self->log_fatal( |
30
|
|
|
|
|
|
|
"changelog '@{[ $self->filename ]}' not found" ); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
CPAN::Changes->load_string( |
33
|
|
|
|
|
|
|
$changes_file->content, |
34
|
|
|
|
|
|
|
next_token => qr/\{\{\$NEXT\}\}/ |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
}, |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub provide_previous_version { |
40
|
6
|
|
|
6
|
0
|
14
|
my $self = shift; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# TODO {{$NEXT}} not generic enough |
43
|
12
|
|
|
12
|
|
58
|
return first { $_ ne '{{$NEXT}}' } |
44
|
6
|
|
|
|
|
266
|
map { $_->version } |
|
12
|
|
|
|
|
235
|
|
45
|
|
|
|
|
|
|
reverse $self->changelog->releases; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=pod |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=encoding UTF-8 |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 NAME |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Dist::Zilla::Plugin::PreviousVersion::Changelog - extract previous version from changelog |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 VERSION |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
version 0.2.6 |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 DESCRIPTION |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Plugin implementing the L<Dist::Zilla::Role::PreviousVersionProvider> role. |
69
|
|
|
|
|
|
|
It provides the previous released version by peeking at the C<Changelog> file |
70
|
|
|
|
|
|
|
and returning its latest release, skipping over C<{{$NEXT}}> if its there |
71
|
|
|
|
|
|
|
(see L<Dist::Zilla::Plugin::NextRelease>). |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Note that this module uses L<CPAN::Changes> to parse the change log. If the |
74
|
|
|
|
|
|
|
file is not well-formed according to its specs, strange things might happen. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 CONFIGURATION |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 filename |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Changelog filename. Defaults to 'Changes'. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 AUTHOR |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Yanick Champoux <yanick@cpan.org> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This software is copyright (c) 2021, 2015, 2014, 2013, 2012 by Yanick Champoux. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
91
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |