| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Dist::Zilla::Plugin::ChangesFromYaml; | 
| 2 |  |  |  |  |  |  | # ABSTRACT: convert Changes from YAML to CPAN::Changes::Spec format | 
| 3 |  |  |  |  |  |  | our $VERSION = '0.005'; # VERSION | 
| 4 |  |  |  |  |  |  |  | 
| 5 | 2 |  |  | 2 |  | 3608464 | use Moose; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 12 |  | 
| 6 |  |  |  |  |  |  | with( 'Dist::Zilla::Role::FileMunger' ); | 
| 7 | 2 |  |  | 2 |  | 8695 | use namespace::autoclean; | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 16 |  | 
| 8 | 2 |  |  | 2 |  | 1026 | use Dist::Zilla::Plugin::ChangesFromYaml::Convert qw(convert); | 
|  | 2 |  |  |  |  | 6 |  | 
|  | 2 |  |  |  |  | 353 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | has dateformat => (is => 'ro', isa => 'Str', default => ''); | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | sub munge_file { | 
| 13 | 14 |  |  | 14 | 0 | 168794 | my ($self, $file) = @_; | 
| 14 |  |  |  |  |  |  |  | 
| 15 | 14 | 100 |  |  |  | 31 | return unless $file->name eq 'Changes'; | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 2 |  |  |  |  | 67 | $file->content( convert( $file->encoded_content, $self->dateformat ) ); | 
| 18 | 2 |  |  |  |  | 2301 | $self->log_debug( | 
| 19 |  |  |  |  |  |  | [ | 
| 20 |  |  |  |  |  |  | 'Converte Changes from YAML to CPAN::Changes::Spec', $file->name | 
| 21 |  |  |  |  |  |  | ] | 
| 22 |  |  |  |  |  |  | ); | 
| 23 |  |  |  |  |  |  | } | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | __PACKAGE__->meta->make_immutable; | 
| 26 |  |  |  |  |  |  | 1; | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | __END__ | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | =head1 NAME | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | Dist::Zilla::Plugin::ChangesFromYaml - convert Changes from YAML to CPAN::Changes::Spec format | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | In your 'dist.ini': | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | [ChangesFromYaml] | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | This module lets you keep your Changes file in YAML format: | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | version: 0.37 | 
| 45 |  |  |  |  |  |  | date:    Fri Oct 25 21:46:59 MYT 2013 | 
| 46 |  |  |  |  |  |  | changes: | 
| 47 |  |  |  |  |  |  | - 'Bugfix: Run Test::Compile tests as xt as they require optional dependencies to be present (GH issue #22)' | 
| 48 |  |  |  |  |  |  | - 'Testing: Added Travis-CI integration' | 
| 49 |  |  |  |  |  |  | - 'Makefile: Added target to update version on all packages' | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | and during build converts it to CPAN::Changes::Spec format | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | 0.37 Fri Oct 25 21:46:59 MYT 2013 | 
| 54 |  |  |  |  |  |  | - Bugfix: Run Test::Compile tests as xt as they require optional | 
| 55 |  |  |  |  |  |  | dependencies to be present (GH issue #22) | 
| 56 |  |  |  |  |  |  | - Testing: Added Travis-CI integration | 
| 57 |  |  |  |  |  |  | - Makefile: Added target to update version on all packages | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | =head1 DATE FORMAT | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | The dates used on the YAML format can also be converted if they don't follow CPAN::Changes::Spec rules. | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | Ie. if you keep your dates as the output of `date` (Sun Oct 27 02:10:50 MYT 2013), add: | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | [ChangesFromYaml] | 
| 66 |  |  |  |  |  |  | dateformat = ccc MMM dd HH:mm:ss zzz yyyy | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | This will convert your dates from: | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | version: 0.37 | 
| 71 |  |  |  |  |  |  | date:    Fri Oct 25 21:46:59 MYT 2013 | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | into: | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | 0.37 2013-10-25 21:46:59 +0800 | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | For documentation on the pattern, read L<DateTime::Format::CLDR>. | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | =head1 AUTHOR | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | Carlos Lima <carlos@cpan.org> | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | =cut |