Plugin/Author/VDB/Hg/Commit.pm

filter: Statementstmt 58.8% 20 / 34 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 44.4% 4 / 9 Podpod 0.0% 0 / 4 totaltotal 47.0% 24 / 51 CC 3 SCAR 11.3
CC
3
Cov
53%
BUILD
6.0
after_release
6.0
__ANON__
2.0
CRAP 3.1
« Plugin/Author/VDB/Version/Bump.pm ↑ Summary Plugin/Author/VDB/Hg/Tag/Check.pm »
1 # ---------------------------------------------------------------------- copyright and license ---
2 #
3 # file: lib/Dist/Zilla/Plugin/Author/VDB/Hg/Commit.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::Commit]
29 #pod file = .hgtags
30 #pod file = remote
31 #pod ...
32 #pod
33 #pod =head1 DESCRIPTION
34 #pod
35 #pod This plugin does C<AfterRelease> role. It commits specified files to the Mercurial repository.
36 #pod
37 #pod =cut
38  
39 # --------------------------------------------------------------------------------------------------
40  
41 package Dist::Zilla::Plugin::Author::VDB::Hg::Commit;
42  
43 1 ▶use Moose;
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: Commit files to repository
48 1 our $VERSION = 'v0.11.3.1'; # TRIAL VERSION
49  
50 1 ▶use Path::Tiny qw{ tempfile };
Subroutine BEGIN: called CC=1 SCAR=0.0
51  
52 1 with 'Dist::Zilla::Role::AfterRelease';
53 1 with 'Dist::Zilla::Role::ErrorLogger';
54 1 with 'Dist::Zilla::Role::Author::VDB::HgRunner';
55  
56 # --------------------------------------------------------------------------------------------------
57  
58 #pod =option message
59 #pod
60 #pod Commit message.
61 #pod
62 #pod =cut
63  
64 1 has message => (
65 isa => 'Str',
66 is => 'ro',
67 default => 'post-release',
68 );
69  
70 # --------------------------------------------------------------------------------------------------
71  
72 #pod =option file
73 #pod
74 #pod =option files
75 #pod
76 #pod File name to commit. May be repeated multiple times to push changes to commit several files.
77 #pod
78 #pod =cut
79  
80 has files => (
81 isa => 'ArrayRef[Str]',
82 is => 'ro',
83 0 ▶ default => sub { [] },
Subroutine __ANON__: not called CC=1 SCAR=6.9
84 1 );
85  
86 # --------------------------------------------------------------------------------------------------
87  
88 #pod =for Pod::Coverage mvp_aliases mvp_multivalue_args
89 #pod
90 #pod =cut
91  
92 0 ▶sub mvp_aliases {
Subroutine mvp_aliases: not called CC=1 SCAR=6.9
Pod undocumented
93 return {
94 0 'file' => 'files',
95 };
96 };
97  
98 0 ▶sub mvp_multivalue_args {
Subroutine mvp_multivalue_args: not called CC=1 SCAR=6.9
Pod undocumented
99 0 return qw{ files };
100 };
101  
102 # --------------------------------------------------------------------------------------------------
103  
104 #pod =for Pod::Coverage BUILD
105 #pod
106 #pod =cut
107  
108 0 ▶sub BUILD {
Subroutine BUILD: not called CC=2 SCAR=17.9
Pod undocumented
109 0 my ( $self ) = @_;
110 0 ▶ if ( $self->message eq '' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->message eq "") 0 0 0
111 0 $self->abort( 'message option must not be empty' );
112 };
113 0 return;
114 };
115  
116 # --------------------------------------------------------------------------------------------------
117  
118 #pod =for Pod::Coverage after_release
119 #pod
120 #pod =cut
121  
122 0 ▶sub after_release {
Subroutine after_release: not called CC=2 SCAR=17.9
Pod undocumented
123 0 my ( $self ) = @_;
124 0 my @files = grep( { $_ ne '' } @{ $self->files } );
125 0 ▶ if ( @files ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@files) 0 0 0
126 0 $self->run_hg( 'commit', '-m', $self->message, @files );
127 };
128 0 return;
129 };
130  
131 # --------------------------------------------------------------------------------------------------
132  
133 1 __PACKAGE__->meta->make_immutable();
134  
135 1 1;
136  
137 # --------------------------------------------------------------------------------------------------
138  
139 #pod =head1 COPYRIGHT AND LICENSE
140 #pod
141 #pod Copyright (C) 2015 Van de Bugger
142 #pod
143 #pod License GPLv3+: The GNU General Public License version 3 or later
144 #pod <http://www.gnu.org/licenses/gpl-3.0.txt>.
145 #pod
146 #pod This is free software: you are free to change and redistribute it. There is
147 #pod NO WARRANTY, to the extent permitted by law.
148 #pod
149 #pod
150 #pod =cut
151  
152 # end of file #
153  
154 __END__
« Plugin/Author/VDB/Version/Bump.pm ↑ Summary Plugin/Author/VDB/Hg/Tag/Check.pm »