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.030;
2             # ABSTRACT: prompt for confirmation before releasing
3              
4 9     9   6663 use Moose;
  9         26  
  9         79  
5             with 'Dist::Zilla::Role::BeforeRelease';
6              
7 9     9   64638 use Dist::Zilla::Pragmas;
  9         27  
  9         97  
8              
9 9     9   88 use namespace::autoclean;
  9         29  
  9         119  
10              
11             sub before_release {
12 9     9 0 142 my ($self, $tgz) = @_;
13              
14             my $releasers = join q{, },
15 9         569 map {; $_->plugin_name }
16 9         69 @{ $self->zilla->plugins_with(-Releaser) };
  9         636  
17              
18 9         255 $self->log("*** Preparing to release $tgz with $releasers ***");
19 9         6891 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       99 : 0;
24              
25 9         435 my $confirmed = $self->zilla->chrome->prompt_yn(
26             $prompt,
27             { default => $default }
28             );
29              
30 9 100       141 $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.030
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 released
74             in the last two to three years. (That is, if the most recently released
75             version is v5.40, then this module should work on both v5.40 and v5.38.)
76              
77             Although it may work on older versions of perl, no guarantee is made that the
78             minimum required version will not be increased. The version may be increased
79             for any reason, and there is no promise that patches will be accepted to lower
80             the minimum required perl.
81              
82             =head1 AUTHOR
83              
84             Ricardo SIGNES 😏 <cpan@semiotic.systems>
85              
86             =head1 COPYRIGHT AND LICENSE
87              
88             This software is copyright (c) 2023 by Ricardo SIGNES.
89              
90             This is free software; you can redistribute it and/or modify it under
91             the same terms as the Perl 5 programming language system itself.
92              
93             =cut