| 1 | use 5.008; # utf8 | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use utf8; | ||
| 5 | |||
| 6 | package Git::Wrapper::Plus; | ||
| 7 | $Git::Wrapper::Plus::VERSION = '0.004010'; | ||
| 8 | # ABSTRACT: A Toolkit for working with Git::Wrapper in an Object Oriented Way. | ||
| 9 | |||
| 10 | our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY | ||
| 11 | |||
| 12 | |||
| 13 | |||
| 14 | |||
| 15 | |||
| 16 | |||
| 17 | |||
| 18 | |||
| 19 | |||
| 20 | |||
| 21 | |||
| 22 | |||
| 23 | |||
| 24 | |||
| 25 | |||
| 26 | |||
| 27 | |||
| 28 | |||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | |||
| 33 | |||
| 34 | |||
| 35 | |||
| 36 | |||
| 37 | |||
| 38 | |||
| 39 | |||
| 40 | |||
| 41 | |||
| 42 | |||
| 43 | |||
| 44 | |||
| 45 | |||
| 46 | |||
| 47 | |||
| 48 | |||
| 49 | |||
| 50 | |||
| 51 | |||
| 52 | |||
| 53 | |||
| 54 | |||
| 55 | |||
| 56 | |||
| 57 | |||
| 58 | |||
| 59 | |||
| 60 | |||
| 61 | |||
| 62 | |||
| 63 | |||
| 64 | |||
| 65 | |||
| 66 | |||
| 67 | |||
| 68 | |||
| 69 | |||
| 70 | |||
| 71 | |||
| 72 | |||
| 73 | |||
| 74 | |||
| 75 | |||
| 76 | |||
| 77 | |||
| 78 | |||
| 79 | |||
| 80 | |||
| 81 | |||
| 82 | |||
| 83 | |||
| 84 | |||
| 85 | |||
| 86 | |||
| 87 | |||
| 88 | |||
| 89 | |||
| 90 | |||
| 91 | |||
| 92 | |||
| 93 | |||
| 94 | |||
| 95 | |||
| 96 | |||
| 97 | |||
| 98 | |||
| 99 | |||
| 100 | |||
| 101 | |||
| 102 | |||
| 103 | |||
| 104 | |||
| 105 | use Moo qw( has ); | ||
| 106 | use Scalar::Util qw( blessed ); | ||
| 107 | |||
| 108 | |||
| 109 | |||
| 110 | |||
| 111 | |||
| 112 | |||
| 113 | |||
| 114 | |||
| 115 | |||
| 116 | |||
| 117 | |||
| 118 | |||
| 119 | sub BUILDARGS { | ||
| 120 | my ( undef, @args ) = @_; | ||
| 121 | if ( 1 == @args ) { | ||
| 122 | blesscheck: { | ||
| 123 | if ( blessed $args[0] ) { | ||
| 124 | if ( $args[0]->isa('Path::Tiny') ) { | ||
| 125 | $args[0] = q[] . $args[0]; | ||
| 126 | last blesscheck; | ||
| 127 | } | ||
| 128 | if ( $args[0]->isa('Path::Class::Dir') ) { | ||
| 129 | $args[0] = q[] . $args[0]; | ||
| 130 | last blesscheck; | ||
| 131 | } | ||
| 132 | if ( $args[0]->isa('Path::Class::File') ) { | ||
| 133 | $args[0] = q[] . $args[0]; | ||
| 134 | last blesscheck; | ||
| 135 | } | ||
| 136 | return { git => $args[0] }; | ||
| 137 | } | ||
| 138 | } | ||
| 139 | return $args[0] if ref $args[0]; | ||
| 140 | |||
| 141 | require Git::Wrapper; | ||
| 142 | return { git => Git::Wrapper->new( $args[0] ) }; | ||
| 143 | } | ||
| 144 | return {@args}; | ||
| 145 | } | ||
| 146 | |||
| 147 | |||
| 148 | |||
| 149 | |||
| 150 | |||
| 151 | |||
| 152 | |||
| 153 | has git => ( is => ro =>, required => 1 ); | ||
| 154 | |||
| 155 | has refs => ( is => ro =>, lazy => 1, builder => 1 ); | ||
| 156 | |||
| 157 | sub _build_refs { | ||
| 158 | my ( $self, ) = @_; | ||
| 159 | require Git::Wrapper::Plus::Refs; | ||
| 160 | return Git::Wrapper::Plus::Refs->new( git => $self->git ); | ||
| 161 | } | ||
| 162 | |||
| 163 | |||
| 164 | |||
| 165 | |||
| 166 | |||
| 167 | has tags => ( is => ro =>, lazy => 1, builder => 1 ); | ||
| 168 | |||
| 169 | sub _build_tags { | ||
| 170 | my ( $self, ) = @_; | ||
| 171 | require Git::Wrapper::Plus::Tags; | ||
| 172 | return Git::Wrapper::Plus::Tags->new( git => $self->git ); | ||
| 173 | } | ||
| 174 | |||
| 175 | |||
| 176 | |||
| 177 | |||
| 178 | |||
| 179 | has branches => ( is => ro =>, lazy => 1, builder => 1 ); | ||
| 180 | |||
| 181 | sub _build_branches { | ||
| 182 | my ( $self, ) = @_; | ||
| 183 | require Git::Wrapper::Plus::Branches; | ||
| 184 | return Git::Wrapper::Plus::Branches->new( git => $self->git ); | ||
| 185 | } | ||
| 186 | |||
| 187 | |||
| 188 | |||
| 189 | |||
| 190 | |||
| 191 | has versions => ( is => ro =>, lazy => 1, builder => 1 ); | ||
| 192 | |||
| 193 | sub _build_versions { | ||
| 194 | my ( $self, ) = @_; | ||
| 195 | require Git::Wrapper::Plus::Versions; | ||
| 196 | return Git::Wrapper::Plus::Versions->new( git => $self->git ); | ||
| 197 | } | ||
| 198 | |||
| 199 | |||
| 200 | |||
| 201 | |||
| 202 | |||
| 203 | has support => ( is => ro =>, lazy => 1, builder => 1 ); | ||
| 204 | |||
| 205 | sub _build_support { | ||
| 206 | my ( $self, ) = @_; | ||
| 207 | require Git::Wrapper::Plus::Support; | ||
| 208 | return Git::Wrapper::Plus::Support->new( git => $self->git ); | ||
| 209 | } | ||
| 210 | |||
| 211 | 1; | ||
| 212 | |||
| 213 | __END__ |