File Coverage

blib/lib/Dist/Zilla/Util/Git/Wrapper.pm
Criterion Covered Total %
statement 25 27 92.5
branch 1 2 50.0
condition n/a
subroutine 8 9 88.8
pod n/a
total 34 38 89.4


line stmt bran cond sub pod time code
1 3     3   72593 use 5.008; # utf8
  3         11  
2 3     3   15 use strict;
  3         7  
  3         78  
3 3     3   25 use warnings;
  3         5  
  3         97  
4 3     3   1119 use utf8;
  3         22  
  3         20  
5              
6             package Dist::Zilla::Util::Git::Wrapper;
7              
8             our $VERSION = '0.004002';
9              
10             # ABSTRACT: Vivify a Git::Wrapper instance for Dist::Zilla
11              
12             our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
13              
14              
15              
16              
17              
18              
19              
20              
21              
22              
23              
24              
25              
26              
27              
28              
29              
30              
31              
32              
33              
34              
35 3     3   1140 use Moose qw( with has );
  3         686124  
  3         20  
36             with 'Dist::Zilla::UtilRole::MaybeZilla';
37 3     3   16282 use Git::Wrapper;
  3         93300  
  3         508  
38              
39             our $AUTOLOAD;
40              
41             ## no critic (ProhibitAutoloading)
42              
43             sub AUTOLOAD {
44 5     5   46807 my ( $self, @args ) = @_;
45 5         13 my $meth = $AUTOLOAD;
46 5         59 $meth =~ s/.+:://msx;
47 5 50       25 return if 'DESTROY' eq $meth;
48 5         408 return $self->git->$meth(@args);
49             }
50              
51              
52              
53              
54              
55              
56              
57              
58              
59              
60              
61              
62              
63              
64             has git => ( isa => 'Object', is => 'ro', lazy_build => 1 );
65              
66             sub _build_git {
67 0     0     my ( $self, ) = @_;
68 0           return Git::Wrapper->new( $self->zilla->root );
69             }
70              
71             __PACKAGE__->meta->make_immutable;
72 3     3   24 no Moose;
  3         5  
  3         26  
73              
74             1;
75              
76             __END__
77              
78             =pod
79              
80             =encoding UTF-8
81              
82             =head1 NAME
83              
84             Dist::Zilla::Util::Git::Wrapper - Vivify a Git::Wrapper instance for Dist::Zilla
85              
86             =head1 VERSION
87              
88             version 0.004002
89              
90             =head1 SYNOPSIS
91              
92             use Dist::Zilla::Util::Git::Wrapper;
93              
94             my $wrapper = Dist::Zilla::Util::Git::Wrapper->new( zilla => $self->zilla );
95              
96             $wrapper->log(); # etc.
97              
98             Yes, this does very little, but simply serves as an abstraction for getting a Git::Wrapper
99             object from git, mostly, because everyone remembers C<< $self->zilla >>, but you have to RTFM
100             and go source diving to know about C<< $self->zilla->root >>
101              
102             This is a simple straight forward way of doing what you want with the least mental overhead.
103              
104             Everything else is just proxy methods for C<< git >>
105              
106             This is a more I.O.C approach to my swathes of C<< Dist::Zilla::Role::Git::LocalRepository >> stuff,
107             which got so complex with dependency management my head exploded.
108              
109             =head1 ATTRIBUTES
110              
111             =head2 C<zilla>
112              
113             Parameter lazily required, and should be a Dist::Zilla object ( or compatible )
114              
115             =head2 C<git>
116              
117             A Git::Wrapper instance. Optional, and pointless to specify manually,
118             but could be useful for testing where you don't want Dist::Zilla
119              
120             Vivified if not specified based on the C<zilla> parameter.
121              
122             =head1 AUTHOR
123              
124             Kent Fredric <kentnl@cpan.org>
125              
126             =head1 COPYRIGHT AND LICENSE
127              
128             This software is copyright (c) 2017 by Kent Fredric <kentfredric@gmail.com>.
129              
130             This is free software; you can redistribute it and/or modify it under
131             the same terms as the Perl 5 programming language system itself.
132              
133             =cut