| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Dist::Zilla::Plugin::Test::CPAN::Changes; | 
| 2 | 1 |  |  | 1 |  | 1744333 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 30 |  | 
| 3 | 1 |  |  | 1 |  | 4 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 51 |  | 
| 4 |  |  |  |  |  |  | # ABSTRACT: release tests for your changelog | 
| 5 |  |  |  |  |  |  | our $VERSION = '0.010'; # VERSION | 
| 6 |  |  |  |  |  |  |  | 
| 7 | 1 |  |  | 1 |  | 7 | use Moose; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 7 |  | 
| 8 | 1 |  |  | 1 |  | 4104 | use Data::Section -setup; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 8 |  | 
| 9 |  |  |  |  |  |  | with | 
| 10 |  |  |  |  |  |  | 'Dist::Zilla::Role::FileGatherer', | 
| 11 |  |  |  |  |  |  | 'Dist::Zilla::Role::PrereqSource'; | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | has changelog => ( | 
| 15 |  |  |  |  |  |  | is      => 'ro', | 
| 16 |  |  |  |  |  |  | isa     => 'Str', | 
| 17 |  |  |  |  |  |  | predicate => 'has_changelog', | 
| 18 |  |  |  |  |  |  | default => 'Changes', | 
| 19 |  |  |  |  |  |  | ); | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | sub gather_files { | 
| 23 | 2 |  |  | 2 | 0 | 48634 | my $self = shift; | 
| 24 |  |  |  |  |  |  |  | 
| 25 | 2 |  |  |  |  | 474 | require Dist::Zilla::File::InMemory; | 
| 26 |  |  |  |  |  |  |  | 
| 27 | 2 |  |  |  |  | 55587 | for my $file (qw( xt/release/cpan-changes.t )){ | 
| 28 | 2 |  |  |  |  | 3 | my $content = ${$self->section_data($file)}; | 
|  | 2 |  |  |  |  | 10 |  | 
| 29 |  |  |  |  |  |  |  | 
| 30 | 2 |  |  |  |  | 678 | my $changes_filename = $self->changelog; | 
| 31 |  |  |  |  |  |  |  | 
| 32 | 2 |  |  |  |  | 12 | $content =~ s/CHANGESFILENAME/$changes_filename/; | 
| 33 |  |  |  |  |  |  |  | 
| 34 | 2 |  |  |  |  | 50 | $self->add_file( Dist::Zilla::File::InMemory->new( | 
| 35 |  |  |  |  |  |  | name => $file, | 
| 36 |  |  |  |  |  |  | content => $content, | 
| 37 |  |  |  |  |  |  | )); | 
| 38 |  |  |  |  |  |  | } | 
| 39 |  |  |  |  |  |  | } | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | # Register the release test prereq as a "develop requires" | 
| 42 |  |  |  |  |  |  | # so it will be listed in "dzil listdeps --author" | 
| 43 |  |  |  |  |  |  | sub register_prereqs { | 
| 44 | 2 |  |  | 2 | 0 | 3969 | my ($self) = @_; | 
| 45 |  |  |  |  |  |  |  | 
| 46 | 2 |  |  |  |  | 50 | $self->zilla->register_prereqs( | 
| 47 |  |  |  |  |  |  | { | 
| 48 |  |  |  |  |  |  | type  => 'requires', | 
| 49 |  |  |  |  |  |  | phase => 'develop', | 
| 50 |  |  |  |  |  |  | }, | 
| 51 |  |  |  |  |  |  | # Latest known release of Test::CPAN::Changes | 
| 52 |  |  |  |  |  |  | # because CPAN authors must use the latest if we want | 
| 53 |  |  |  |  |  |  | # this check to be relevant | 
| 54 |  |  |  |  |  |  | 'Test::CPAN::Changes'     => '0.19', | 
| 55 |  |  |  |  |  |  | ); | 
| 56 |  |  |  |  |  |  | } | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | __PACKAGE__->meta->make_immutable; | 
| 63 | 1 |  |  | 1 |  | 558 | no Moose; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | =pod | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | =encoding UTF-8 | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | =head1 NAME | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | Dist::Zilla::Plugin::Test::CPAN::Changes - release tests for your changelog | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | =head1 VERSION | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | version 0.010 | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | =for test_synopsis BEGIN { die "SKIP: synopsis isn't perl code" } | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | In C<dist.ini>: | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | [Test::CPAN::Changes] | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | This is an extension of L<Dist::Zilla::Plugin::InlineFiles>, providing the | 
| 88 |  |  |  |  |  |  | following file: | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | xt/release/cpan-changes.t - a standard Test::CPAN::Changes test | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | See L<Test::CPAN::Changes> for what this test does. | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | =head2 Alternate changelog filenames | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | L<CPAN::Changes::Spec> specifies that the changelog will be called 'Changes' - | 
| 97 |  |  |  |  |  |  | if you want to use a different filename for whatever reason, do: | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | [Test::CPAN::Changes] | 
| 100 |  |  |  |  |  |  | changelog = CHANGES | 
| 101 |  |  |  |  |  |  |  | 
| 102 |  |  |  |  |  |  | and that file will be tested instead. | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  | =for Pod::Coverage gather_files register_prereqs | 
| 105 |  |  |  |  |  |  |  | 
| 106 |  |  |  |  |  |  | =head1 AVAILABILITY | 
| 107 |  |  |  |  |  |  |  | 
| 108 |  |  |  |  |  |  | The project homepage is L<http://metacpan.org/release/Dist-Zilla-Plugin-Test-CPAN-Changes/>. | 
| 109 |  |  |  |  |  |  |  | 
| 110 |  |  |  |  |  |  | The latest version of this module is available from the Comprehensive Perl | 
| 111 |  |  |  |  |  |  | Archive Network (CPAN). Visit L<http://www.perl.com/CPAN/> to find a CPAN | 
| 112 |  |  |  |  |  |  | site near you, or see L<https://metacpan.org/module/Dist::Zilla::Plugin::Test::CPAN::Changes/>. | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | =head1 SOURCE | 
| 115 |  |  |  |  |  |  |  | 
| 116 |  |  |  |  |  |  | The development version is on github at L<http://github.com/doherty/Dist-Zilla-Plugin-Test-CPAN-Changes> | 
| 117 |  |  |  |  |  |  | and may be cloned from L<git://github.com/doherty/Dist-Zilla-Plugin-Test-CPAN-Changes.git> | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  | =head1 BUGS AND LIMITATIONS | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | You can make new bug reports, and view existing ones, through the | 
| 122 |  |  |  |  |  |  | web interface at L<https://github.com/doherty/Dist-Zilla-Plugin-Test-CPAN-Changes/issues>. | 
| 123 |  |  |  |  |  |  |  | 
| 124 |  |  |  |  |  |  | =head1 AUTHOR | 
| 125 |  |  |  |  |  |  |  | 
| 126 |  |  |  |  |  |  | Mike Doherty <doherty@cpan.org> | 
| 127 |  |  |  |  |  |  |  | 
| 128 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 129 |  |  |  |  |  |  |  | 
| 130 |  |  |  |  |  |  | This software is copyright (c) 2011 by Mike Doherty. | 
| 131 |  |  |  |  |  |  |  | 
| 132 |  |  |  |  |  |  | This is free software; you can redistribute it and/or modify it under | 
| 133 |  |  |  |  |  |  | the same terms as the Perl 5 programming language system itself. | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | =cut | 
| 136 |  |  |  |  |  |  |  | 
| 137 |  |  |  |  |  |  | __DATA__ | 
| 138 |  |  |  |  |  |  | __[ xt/release/cpan-changes.t ]__ | 
| 139 |  |  |  |  |  |  | #!perl | 
| 140 |  |  |  |  |  |  |  | 
| 141 |  |  |  |  |  |  | use strict; | 
| 142 |  |  |  |  |  |  | use warnings; | 
| 143 |  |  |  |  |  |  |  | 
| 144 |  |  |  |  |  |  | use Test::More 0.96 tests => 1; | 
| 145 |  |  |  |  |  |  | use Test::CPAN::Changes; | 
| 146 |  |  |  |  |  |  | subtest 'changes_ok' => sub { | 
| 147 |  |  |  |  |  |  | changes_file_ok('CHANGESFILENAME'); | 
| 148 |  |  |  |  |  |  | }; | 
| 149 |  |  |  |  |  |  | done_testing(); |