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