File Coverage

lib/Dist/Zilla/Plugin/CSJEWELL/ReleaseStatusFromMetaJSON.pm
Criterion Covered Total %
statement 11 23 47.8
branch 0 6 0.0
condition n/a
subroutine 4 5 80.0
pod 0 1 0.0
total 15 35 42.8


line stmt bran cond sub pod time code
1             package Dist::Zilla::Plugin::CSJEWELL::ReleaseStatusFromMetaJSON;
2              
3             our $VERSION = v0.001;
4              
5 1     1   123838 use v5.10;
  1         14  
6 1     1   544 use JSON::MaybeXS qw();
  1         6510  
  1         25  
7 1     1   678 use Moose;
  1         499529  
  1         11  
8             with 'Dist::Zilla::Role::ReleaseStatusProvider';
9              
10             sub provide_release_status {
11 0     0 0   my ($self) = @_;
12 0           my ($file) = grep { $_->name eq 'META.json' } @{ $self->zilla->files };
  0            
  0            
13 0           my $ref = JSON::MaybeXS->new()->utf8->decode($file->encoded_content);
14              
15 0           my $status = $ref->{'release_status'};
16 0 0         return $status unless $status;
17 0 0         if ($status eq 'unstable') {
    0          
18 0           $self->log(['Releasing an unstable version']);
19             } elsif ($status eq 'testing') {
20 0           $self->log(['Releasing a testing version']);
21             } else {
22 0           $self->log(['Releasing a stable version']);
23             }
24              
25 0           return $status;
26             } ## end sub provide_release_status
27              
28             __PACKAGE__->meta->make_immutable;
29 1     1   8504 no Moose;
  1         3  
  1         7  
30              
31             1;
32              
33             __END__
34              
35             =pod
36              
37             =encoding UTF-8
38              
39             =head1 NAME
40              
41             Dist::Zilla::Plugin::CSJEWELL::JSONReleaseStatus - Set release status from META.json
42              
43             =head1 VERSION
44              
45             version 0.994
46              
47             =for Pod::Coverage provide_release_status
48              
49             =head1 AUTHORS
50              
51             =over 4
52              
53             =item *
54              
55             Curtis Jewell <CSJewell@cpan.org>
56              
57             =back
58              
59             =head1 COPYRIGHT AND LICENSE
60              
61             This software is copyright (c) 2021 by Curtis Jewell
62              
63             This is free software; you can redistribute it and/or modify it under
64             the same terms as the Perl 5 programming language system itself.
65              
66             =cut