| 1 | 2 | ▶ | use 5.006; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | package Gentoo::Overlay::Ebuild; | ||||||||||
| 6 | |||||||||||
| 7 | 2 | our $VERSION = '2.001002'; | |||||||||
| 8 | |||||||||||
| 9 | # ABSTRACT: A Class for Ebuilds in Gentoo Overlays | ||||||||||
| 10 | |||||||||||
| 11 | 2 | our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY | |||||||||
| 12 | |||||||||||
| 13 | 2 | ▶ | use Moo qw( has ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 2 | ▶ | use MooseX::Has::Sugar qw( required ro lazy ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 2 | ▶ | use Types::Standard qw( HashRef Str ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 2 | ▶ | use Types::Path::Tiny qw( File Dir ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 2 | ▶ | use MooX::ClassAttribute qw( class_has ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 2 | ▶ | use Gentoo::Overlay::Types qw( Gentoo__Overlay_EbuildName Gentoo__Overlay_Package ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 2 | ▶ | use namespace::clean -except => 'meta'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 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 | 2 | has name => ( isa => Gentoo__Overlay_EbuildName, required, ro ); | |||||||||
| 78 | 2 | has package => ( | |||||||||
| 79 | isa => Gentoo__Overlay_Package, | ||||||||||
| 80 | required, ro, | ||||||||||
| 81 | handles => [qw( overlay category )], | ||||||||||
| 82 | ); | ||||||||||
| 83 | |||||||||||
| 84 | has path => ( | ||||||||||
| 85 | isa => File, | ||||||||||
| 86 | ro, | ||||||||||
| 87 | lazy, | ||||||||||
| 88 | 1 | ▶ | default => sub { | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 89 | 1 | my ($self) = shift; | |||||||||
| 90 | 1 | return $self->overlay->default_path( 'ebuild', $self->category->name, $self->package->name, $self->name ); | |||||||||
| 91 | }, | ||||||||||
| 92 | 2 | ); | |||||||||
| 93 | |||||||||||
| 94 | |||||||||||
| 95 | |||||||||||
| 96 | |||||||||||
| 97 | |||||||||||
| 98 | |||||||||||
| 99 | |||||||||||
| 100 | |||||||||||
| 101 | |||||||||||
| 102 | |||||||||||
| 103 | |||||||||||
| 104 | |||||||||||
| 105 | |||||||||||
| 106 | |||||||||||
| 107 | |||||||||||
| 108 | |||||||||||
| 109 | |||||||||||
| 110 | |||||||||||
| 111 | |||||||||||
| 112 | |||||||||||
| 113 | |||||||||||
| 114 | |||||||||||
| 115 | |||||||||||
| 116 | |||||||||||
| 117 | |||||||||||
| 118 | |||||||||||
| 119 | |||||||||||
| 120 | |||||||||||
| 121 | class_has _scan_blacklist => ( | ||||||||||
| 122 | isa => HashRef [Str], | ||||||||||
| 123 | ro, | ||||||||||
| 124 | lazy, | ||||||||||
| 125 | 1 | ▶ | default => sub { | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 126 | 1 | return { map { $_ => 1 } qw( . .. ChangeLog Manifest metadata.xml ) }; | |||||||||
| 127 | }, | ||||||||||
| 128 | 2 | ); | |||||||||
| 129 | |||||||||||
| 130 | 1 | ▶ | sub _scan_blacklisted { | ||||||||
|
Subroutine
_scan_blacklisted: called CC=1 SCAR=0.0
| |||||||||||
| 131 | 1 | my ( $self, $what ) = @_; | |||||||||
| 132 | 1 | return exists $self->_scan_blacklist->{$what}; | |||||||||
| 133 | } | ||||||||||
| 134 | |||||||||||
| 135 | |||||||||||
| 136 | |||||||||||
| 137 | |||||||||||
| 138 | |||||||||||
| 139 | |||||||||||
| 140 | |||||||||||
| 141 | |||||||||||
| 142 | |||||||||||
| 143 | |||||||||||
| 144 | ## no critic ( ProhibitBuiltinHomonyms ) | ||||||||||
| 145 | 1 | ▶ | sub exists { | ||||||||
|
Subroutine
exists: called CC=5 SCAR=17.2
Pod
documented
| |||||||||||
| 146 | 1 | my $self = shift; | |||||||||
| 147 | 1 | ▶ | return if q{.} eq $self->name; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 148 | 1 | ▶ | return if q{..} eq $self->name; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 149 | 1 | ▶ | return unless $self->path->exists; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 150 | 1 | ▶ | return if $self->path->is_dir; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 151 | 1 | return 1; | |||||||||
| 152 | } | ||||||||||
| 153 | |||||||||||
| 154 | |||||||||||
| 155 | |||||||||||
| 156 | |||||||||||
| 157 | |||||||||||
| 158 | |||||||||||
| 159 | |||||||||||
| 160 | |||||||||||
| 161 | |||||||||||
| 162 | 1 | ▶ | sub is_blacklisted { | ||||||||
|
Subroutine
is_blacklisted: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||
| 163 | 1 | my ( $self, $name ) = @_; | |||||||||
| 164 | 1 | ▶ | if ( not defined $name ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 165 | 0 | $name = $self->name; | |||||||||
| 166 | } | ||||||||||
| 167 | 1 | return $self->_scan_blacklisted($name); | |||||||||
| 168 | } | ||||||||||
| 169 | |||||||||||
| 170 | |||||||||||
| 171 | |||||||||||
| 172 | |||||||||||
| 173 | |||||||||||
| 174 | |||||||||||
| 175 | |||||||||||
| 176 | |||||||||||
| 177 | |||||||||||
| 178 | 0 | ▶ | sub pretty_name { | ||||||||
|
Subroutine
pretty_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 179 | 0 | my $self = shift; | |||||||||
| 180 | 0 | my $filename = $self->name; | |||||||||
| 181 | ## no critic (RegularExpressions) | ||||||||||
| 182 | 0 | $filename =~ s/\.ebuild$//; | |||||||||
| 183 | 0 | return q{=} . $self->category->name . q{/} . $filename . q{::} . $self->overlay->name; | |||||||||
| 184 | } | ||||||||||
| 185 | |||||||||||
| 186 | 2 | ▶ | no Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 187 | 2 | 1; | |||||||||
| 188 | |||||||||||
| 189 | __END__ | ||||||||||