| 1 | package Dist::Zilla::Plugin::ConfirmRelease 6.040; | ||||||||||
| 2 | # ABSTRACT: prompt for confirmation before releasing | ||||||||||
| 3 | |||||||||||
| 4 | 9 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 9 | with 'Dist::Zilla::Role::BeforeRelease'; | |||||||||
| 6 | |||||||||||
| 7 | 9 | ▶ | use Dist::Zilla::Pragmas; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 9 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 9 | ▶ | sub before_release { | ||||||||
|
Subroutine
before_release: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 12 | 9 | my ($self, $tgz) = @_; | |||||||||
| 13 | |||||||||||
| 14 | my $releasers = join q{, }, | ||||||||||
| 15 | 9 | map {; $_->plugin_name } | |||||||||
| 16 | 9 | @{ $self->zilla->plugins_with(-Releaser) }; | |||||||||
| 17 | |||||||||||
| 18 | 9 | $self->log("*** Preparing to release $tgz with $releasers ***"); | |||||||||
| 19 | 9 | 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 | ▶ | : 0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | |||||||||||
| 25 | 9 | my $confirmed = $self->zilla->chrome->prompt_yn( | |||||||||
| 26 | $prompt, | ||||||||||
| 27 | { default => $default } | ||||||||||
| 28 | ); | ||||||||||
| 29 | |||||||||||
| 30 | 9 | ▶ | $self->log_fatal("Aborting release") unless $confirmed; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 9 | __PACKAGE__->meta->make_immutable; | |||||||||
| 34 | 9 | 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__ | ||||||||||