| 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 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 43 | 1 | ▶ | use autodie ':all'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 44 | 1 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 45 | 1 | ▶ | use version 0.77; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 46 | |||||||||||
| 47 | # ABSTRACT: Make sure tag doesn't exist yet | ||||||||||
| 48 | 1 | our $VERSION = 'v0.11.3.1'; # TRIAL VERSION | |||||||||
| 49 | |||||||||||
| 50 | 1 | with 'Dist::Zilla::Role::BeforeRelease'; | |||||||||
| 51 | 1 | with 'Dist::Zilla::Role::ErrorLogger'; | |||||||||
| 52 | 1 | with 'Dist::Zilla::Role::Author::VDB::HgRunner'; | |||||||||
| 53 | |||||||||||
| 54 | #pod =for Pod::Coverage before_release | ||||||||||
| 55 | #pod | ||||||||||
| 56 | #pod =cut | ||||||||||
| 57 | |||||||||||
| 58 | 0 | ▶ | sub before_release { | ||||||||
|
Subroutine
before_release: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 59 | 0 | my ( $self ) = @_; | |||||||||
| 60 | 0 | my $version = $self->zilla->version; | |||||||||
| 61 | 0 | my $tags = $self->run_hg( 'tags' ); | |||||||||
| 62 | 0 | ▶ | if ( grep( { $_ =~ m{ ^ \Q$version\E \s }x } @$tags ) ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 63 | 0 | $self->abort( [ "Tag '%s' already exists", $version ] ); | |||||||||
| 64 | }; | ||||||||||
| 65 | 0 | return; | |||||||||
| 66 | }; | ||||||||||
| 67 | |||||||||||
| 68 | # -------------------------------------------------------------------------------------------------- | ||||||||||
| 69 | |||||||||||
| 70 | 1 | __PACKAGE__->meta->make_immutable(); | |||||||||
| 71 | |||||||||||
| 72 | 1 | 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__ | ||||||||||