File Coverage

blib/lib/Dist/Zilla/Plugin/ConfirmRelease.pm
Criterion Covered Total %
statement 18 18 100.0
branch 4 4 100.0
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 26 27 96.3


line stmt bran cond sub pod time code
1             # ABSTRACT: prompt for confirmation before releasing
2              
3             use Moose;
4 9     9   6446 with 'Dist::Zilla::Role::BeforeRelease';
  9         25  
  9         71  
5              
6             use Dist::Zilla::Pragmas;
7 9     9   62124  
  9         22  
  9         89  
8             use namespace::autoclean;
9 9     9   75  
  9         26  
  9         93  
10             my ($self, $tgz) = @_;
11              
12 9     9 0 59 my $releasers = join q{, },
13             map {; $_->plugin_name }
14             @{ $self->zilla->plugins_with(-Releaser) };
15 9         475  
16 9         65 $self->log("*** Preparing to release $tgz with $releasers ***");
  9         475  
17             my $prompt = "Do you want to continue the release process?";
18 9         202  
19 9         6395 my $default = exists $ENV{DZIL_CONFIRMRELEASE_DEFAULT}
20             ? $ENV{DZIL_CONFIRMRELEASE_DEFAULT}
21             : 0;
22              
23 9 100       83 my $confirmed = $self->zilla->chrome->prompt_yn(
24             $prompt,
25 9         357 { default => $default }
26             );
27              
28             $self->log_fatal("Aborting release") unless $confirmed;
29             }
30 9 100       196  
31             __PACKAGE__->meta->make_immutable;
32             1;
33              
34             #pod =head1 DESCRIPTION
35             #pod
36             #pod This plugin prompts the author whether or not to continue before releasing
37             #pod the distribution to CPAN. It gives authors a chance to abort before
38             #pod they upload.
39             #pod
40             #pod The default is "no", but you can set the environment variable
41             #pod C<DZIL_CONFIRMRELEASE_DEFAULT> to "yes" if you just want to hit enter to
42             #pod release.
43              
44              
45             =pod
46              
47             =encoding UTF-8
48              
49             =head1 NAME
50              
51             Dist::Zilla::Plugin::ConfirmRelease - prompt for confirmation before releasing
52              
53             =head1 VERSION
54              
55             version 6.028
56              
57             =head1 DESCRIPTION
58              
59             This plugin prompts the author whether or not to continue before releasing
60             the distribution to CPAN. It gives authors a chance to abort before
61             they upload.
62              
63             The default is "no", but you can set the environment variable
64             C<DZIL_CONFIRMRELEASE_DEFAULT> to "yes" if you just want to hit enter to
65             release.
66              
67             =head1 PERL VERSION
68              
69             This module should work on any version of perl still receiving updates from
70             the Perl 5 Porters. This means it should work on any version of perl released
71             in the last two to three years. (That is, if the most recently released
72             version is v5.40, then this module should work on both v5.40 and v5.38.)
73              
74             Although it may work on older versions of perl, no guarantee is made that the
75             minimum required version will not be increased. The version may be increased
76             for any reason, and there is no promise that patches will be accepted to lower
77             the minimum required perl.
78              
79             =head1 AUTHOR
80              
81             Ricardo SIGNES 😏 <cpan@semiotic.systems>
82              
83             =head1 COPYRIGHT AND LICENSE
84              
85             This software is copyright (c) 2022 by Ricardo SIGNES.
86              
87             This is free software; you can redistribute it and/or modify it under
88             the same terms as the Perl 5 programming language system itself.
89              
90             =cut