File Coverage

lib/Dist/Zilla/Util/Git/Wrapper.pm
Criterion Covered Total %
statement 13 15 86.6
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 20 90.0


line stmt bran cond sub pod time code
1 2     2   29862 use 5.008; # utf8
  2         6  
  2         67  
2 2     2   9 use strict;
  2         4  
  2         57  
3 2     2   15 use warnings;
  2         3  
  2         45  
4 2     2   1016 use utf8;
  2         15  
  2         8  
5              
6             package Dist::Zilla::Util::Git::Wrapper;
7              
8             our $VERSION = '0.004001';
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 2     2   1242 use Moose qw( with has );
  0            
  0            
36             with 'Dist::Zilla::UtilRole::MaybeZilla';
37             use Git::Wrapper;
38              
39             our $AUTOLOAD;
40              
41             ## no critic (ProhibitAutoloading)
42              
43             sub AUTOLOAD {
44             my ( $self, @args ) = @_;
45             my $meth = $AUTOLOAD;
46             $meth =~ s/.+:://msx;
47             return if 'DESTROY' eq $meth;
48             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             my ( $self, ) = @_;
68             return Git::Wrapper->new( $self->zilla->root );
69             }
70              
71             __PACKAGE__->meta->make_immutable;
72             no Moose;
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.004001
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) 2014 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