File Coverage

blib/lib/Dist/Zilla/Plugin/Author/VDB/Hg/Tag/Check.pm
Criterion Covered Total %
statement 12 19 63.1
branch 0 2 0.0
condition n/a
subroutine 4 5 80.0
pod 0 1 0.0
total 16 27 59.2


line stmt bran cond sub pod time code
1             # ---------------------------------------------------------------------- copyright and license ---
2             #
3             # file: lib/Dist/Zilla/Plugin/Author/VDB/Hg/Tag/Check.pm
4             #
5             # Copyright © 2015 Van de Bugger
6             #
7             # This file is part of perl-Dist-Zilla-PluginBundle-Author-VDB.
8             #
9             # perl-Dist-Zilla-PluginBundle-Author-VDB is free software: you can redistribute it and/or modify
10             # it under the terms of the GNU General Public License as published by the Free Software
11             # Foundation, either version 3 of the License, or (at your option) any later version.
12             #
13             # perl-Dist-Zilla-PluginBundle-Author-VDB is distributed in the hope that it will be useful, but
14             # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
15             # PARTICULAR PURPOSE. See the GNU General Public License for more details.
16             #
17             # You should have received a copy of the GNU General Public License along with
18             # perl-Dist-Zilla-PluginBundle-Author-VDB. If not, see <http://www.gnu.org/licenses/>.
19             #
20             # ---------------------------------------------------------------------- copyright and license ---
21              
22             #pod =for test_synopsis BEGIN { die "SKIP: not a Perl code"; }
23             #pod
24             #pod =head1 SYNOPSIS
25             #pod
26             #pod F<dist.in> file:
27             #pod
28             #pod [Author::VDB::Hg::Tag::Check]
29             #pod
30             #pod =head1 DESCRIPTION
31             #pod
32             #pod This plugin does C<BeforeRelease> role. It makes sure the version to release is not yet tagged in
33             #pod Mercurial repository (i. e. there is no tag the same as the current version). If version is already
34             #pod tagged, the plugin aborts release.
35             #pod
36             #pod =cut
37              
38             # --------------------------------------------------------------------------------------------------
39              
40             package Dist::Zilla::Plugin::Author::VDB::Hg::Tag::Check;
41              
42 1     1   3646122 use Moose;
  1         2  
  1         8  
43 1     1   5495 use autodie ':all';
  1         2  
  1         10  
44 1     1   8985 use namespace::autoclean;
  1         2  
  1         10  
45 1     1   74 use version 0.77;
  1         31  
  1         11  
46              
47             # ABSTRACT: Make sure tag doesn't exist yet
48             our $VERSION = 'v0.11.2_06'; # TRIAL VERSION
49              
50             with 'Dist::Zilla::Role::BeforeRelease';
51             with 'Dist::Zilla::Role::ErrorLogger';
52             with 'Dist::Zilla::Role::Author::VDB::HgRunner';
53              
54             #pod =for Pod::Coverage before_release
55             #pod
56             #pod =cut
57              
58             sub before_release {
59 0     0 0   my ( $self ) = @_;
60 0           my $version = $self->zilla->version;
61 0           my $tags = $self->run_hg( 'tags' );
62 0 0         if ( grep( { $_ =~ m{ ^ \Q$version\E \s }x } @$tags ) ) {
  0            
63 0           $self->abort( [ "Tag '%s' already exists", $version ] );
64             };
65 0           return;
66             };
67              
68             # --------------------------------------------------------------------------------------------------
69              
70             __PACKAGE__->meta->make_immutable();
71              
72             1;
73              
74             # --------------------------------------------------------------------------------------------------
75              
76             #pod =head1 COPYRIGHT AND LICENSE
77             #pod
78             #pod Copyright (C) 2015 Van de Bugger
79             #pod
80             #pod License GPLv3+: The GNU General Public License version 3 or later
81             #pod <http://www.gnu.org/licenses/gpl-3.0.txt>.
82             #pod
83             #pod This is free software: you are free to change and redistribute it. There is
84             #pod NO WARRANTY, to the extent permitted by law.
85             #pod
86             #pod
87             #pod =cut
88              
89             # end of file #
90              
91             __END__
92              
93             =pod
94              
95             =encoding UTF-8
96              
97             =head1 NAME
98              
99             Dist::Zilla::Plugin::Author::VDB::Hg::Tag::Check - Make sure tag doesn't exist yet
100              
101             =head1 VERSION
102              
103             Version v0.11.2_06, released on 2016-12-15 22:13 UTC.
104             This is a B<trial release>.
105              
106             =for test_synopsis BEGIN { die "SKIP: not a Perl code"; }
107              
108             =head1 SYNOPSIS
109              
110             F<dist.in> file:
111              
112             [Author::VDB::Hg::Tag::Check]
113              
114             =head1 DESCRIPTION
115              
116             This plugin does C<BeforeRelease> role. It makes sure the version to release is not yet tagged in
117             Mercurial repository (i. e. there is no tag the same as the current version). If version is already
118             tagged, the plugin aborts release.
119              
120             =for Pod::Coverage before_release
121              
122             =head1 AUTHOR
123              
124             Van de Bugger <van.de.bugger@gmail.com>
125              
126             =head1 COPYRIGHT AND LICENSE
127              
128             Copyright (C) 2015 Van de Bugger
129              
130             License GPLv3+: The GNU General Public License version 3 or later
131             <http://www.gnu.org/licenses/gpl-3.0.txt>.
132              
133             This is free software: you are free to change and redistribute it. There is
134             NO WARRANTY, to the extent permitted by law.
135              
136             =cut