File Coverage

blib/lib/Dist/Zilla/Role/Author/VDB/HgRunner.pm
Criterion Covered Total %
statement 15 19 78.9
branch 0 4 0.0
condition n/a
subroutine 5 6 83.3
pod 1 1 100.0
total 21 30 70.0


line stmt bran cond sub pod time code
1             # ---------------------------------------------------------------------- copyright and license ---
2             #
3             # file: lib/Dist/Zilla/Role/HgRunner.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             package Dist::Zilla::Role::Author::VDB::HgRunner;
23              
24 1     1   741 use Moose::Role;
  1         2  
  1         16  
25 1     1   4276 use namespace::autoclean;
  1         2  
  1         9  
26 1     1   65 use version 0.77;
  1         26  
  1         8  
27              
28             # ABSTRACT: TODO
29             our $VERSION = 'v0.11.2_05'; # TRIAL VERSION
30              
31 1     1   76 use Path::Tiny;
  1         1  
  1         61  
32 1     1   6 use Carp qw{ croak };
  1         2  
  1         192  
33              
34             with 'Dist::Zilla::Role::Author::VDB::ProgramRunner';
35              
36             # --------------------------------------------------------------------------------------------------
37              
38             #pod =method run_hg
39             #pod
40             #pod @stdout = @{ $self->run_hg( @arguments ) };
41             #pod
42             #pod =cut
43              
44             sub run_hg {
45 0     0 1   my ( $self, @args ) = @_;
46 0 0         @args > 0 or croak "run_hg: at least one argument expected";
47 0           my $root = path( $self->zilla->root );
48 0 0         return $self->run_program(
49             'hg',
50             '--cwd', "$root",
51             $args[ 0 ] ne 'init' ? ( '-R', '.' ) : (), # `hg init` does not like `-R` option.
52             @args
53             );
54             };
55              
56             # --------------------------------------------------------------------------------------------------
57              
58             1;
59              
60             # --------------------------------------------------------------------------------------------------
61              
62             #pod =head1 COPYRIGHT AND LICENSE
63             #pod
64             #pod Copyright (C) 2015 Van de Bugger
65             #pod
66             #pod License GPLv3+: The GNU General Public License version 3 or later
67             #pod <http://www.gnu.org/licenses/gpl-3.0.txt>.
68             #pod
69             #pod This is free software: you are free to change and redistribute it. There is
70             #pod NO WARRANTY, to the extent permitted by law.
71             #pod
72             #pod
73             #pod =cut
74              
75             # end of file #
76              
77             __END__
78              
79             =pod
80              
81             =encoding UTF-8
82              
83             =head1 NAME
84              
85             Dist::Zilla::Role::Author::VDB::HgRunner - TODO
86              
87             =head1 VERSION
88              
89             Version v0.11.2_05, released on 2016-12-08 00:45 UTC.
90             This is a B<trial release>.
91              
92             =head1 OBJECT METHODS
93              
94             =head2 run_hg
95              
96             @stdout = @{ $self->run_hg( @arguments ) };
97              
98             =head1 AUTHOR
99              
100             Van de Bugger <van.de.bugger@gmail.com>
101              
102             =head1 COPYRIGHT AND LICENSE
103              
104             Copyright (C) 2015 Van de Bugger
105              
106             License GPLv3+: The GNU General Public License version 3 or later
107             <http://www.gnu.org/licenses/gpl-3.0.txt>.
108              
109             This is free software: you are free to change and redistribute it. There is
110             NO WARRANTY, to the extent permitted by law.
111              
112             =cut