File Coverage

blib/lib/Dist/Zilla/Plugin/BlockRelease.pm
Criterion Covered Total %
statement 19 19 100.0
branch n/a
condition n/a
subroutine 7 8 87.5
pod 0 3 0.0
total 26 30 86.6


line stmt bran cond sub pod time code
1 1     1   740842 use strict;
  1         3  
  1         31  
2 1     1   6 use warnings;
  1         2  
  1         63  
3             package Dist::Zilla::Plugin::BlockRelease; # git description: v0.002-17-g4b5f572
4             # ABSTRACT: Prevent a release from occurring
5             # KEYWORDS: plugin distribution release sanity safety prevent
6             # vim: set ts=8 sts=4 sw=4 tw=115 et :
7              
8             our $VERSION = '0.003';
9              
10 1     1   5 use Moose;
  1         2  
  1         9  
11             with 'Dist::Zilla::Role::BeforeRelease',
12             'Dist::Zilla::Role::Releaser';
13              
14 1     1   6441 use Term::ANSIColor 3.00 'colored';
  1         36  
  1         63  
15 1     1   6 use namespace::autoclean;
  1         1  
  1         10  
16              
17             sub BUILD
18             {
19 1     1 0 2 my $self = shift;
20 1         5 $self->log('releases will be prevented!');
21             }
22              
23             around dump_config => sub
24             {
25             my ($orig, $self) = @_;
26             my $config = $self->$orig;
27              
28             my $data = {
29             blessed($self) ne __PACKAGE__ ? ( version => $VERSION ) : (),
30             };
31             $config->{+__PACKAGE__} = $data if keys %$data;
32              
33             return $config;
34             };
35              
36             sub before_release
37             {
38 1     1 0 244875 my $self = shift;
39 1         31 $self->log_fatal(colored('halting release', 'yellow'));
40             }
41              
42       0 0   sub release {}
43              
44             __PACKAGE__->meta->make_immutable;
45              
46             __END__
47              
48             =pod
49              
50             =encoding UTF-8
51              
52             =head1 NAME
53              
54             Dist::Zilla::Plugin::BlockRelease - Prevent a release from occurring
55              
56             =head1 VERSION
57              
58             version 0.003
59              
60             =head1 SYNOPSIS
61              
62             In your F<dist.ini>:
63              
64             [BlockRelease]
65              
66             =head1 DESCRIPTION
67              
68             This plugin, when loaded, prevents C<dzil release> from completing. It is
69             useful to include temporarily, while developing (perhaps while using some
70             development-only requirements or code, to guard against an accidental release.
71              
72             Load it last to allow all other C<BeforeRelease> plugins to still perform
73             their checks, or first to stop these pre-release checks from occurring.
74              
75             =for Pod::Coverage BUILD before_release release
76              
77             =head1 SUPPORT
78              
79             Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Plugin-BlockRelease>
80             (or L<bug-Dist-Zilla-Plugin-BlockRelease@rt.cpan.org|mailto:bug-Dist-Zilla-Plugin-BlockRelease@rt.cpan.org>).
81              
82             There is also a mailing list available for users of this distribution, at
83             L<http://dzil.org/#mailing-list>.
84              
85             There is also an irc channel available for users of this distribution, at
86             L<irc://irc.perl.org/#distzilla>.
87              
88             I am also usually active on irc, as 'ether' at C<irc.perl.org>.
89              
90             =head1 AUTHOR
91              
92             Karen Etheridge <ether@cpan.org>
93              
94             =head1 COPYRIGHT AND LICENCE
95              
96             This software is copyright (c) 2014 by Karen Etheridge.
97              
98             This is free software; you can redistribute it and/or modify it under
99             the same terms as the Perl 5 programming language system itself.
100              
101             =cut