lib/App/GitFind/Entry/GitIndex.pm

filter: Statementstmt 65.7% 25 / 38 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 53.3% 8 / 15 Podpod 100% 2 / 2 totaltotal 55.5% 35 / 63 CC 5 SCAR 21.9
CC
5
Cov
54%
BUILD
30.0
__ANON__
2.0
__ANON__
2.0
CRAP 9.0
« lib/App/GitFind/Searcher/FileSystem.pm ↑ Summary lib/App/GitFind/Actions.pm »
1 # App::GitFind::Entry::GitIndex - App::GitFind::Entry wrapper for a Git::Raw::Index::Entry
2 package App::GitFind::Entry::GitIndex;
3  
4 1 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use App::GitFind::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 #use Path::Class;
9 1 ▶use App::GitFind::PathClassMicro;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 our $VERSION = '0.000002';
12  
13 1 ▶use parent 'App::GitFind::Entry';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 # Fields. Not all have values.
16 1 ▶use Class::Tiny _qwc <<'EOT';
Subroutine BEGIN: called CC=1 SCAR=0.0
17 obj # A Git::Raw::Index::Entry instance. Required.
18 repo # A Git::Raw::Repository instance. Required.
19 EOT
20  
21 1 ▶use Class::Tiny::Immutable {
Subroutine BEGIN: called CC=1 SCAR=2.2
22 # Lazy cache of an App::GitFind::PathClassMicro::File instance for this path
23 0 ▶ '_pathclass' => sub { App::GitFind::PathClassMicro::File->new($_[0]->repo->workdir, $_[0]->obj->path) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
24  
25 0 ▶ '_lstat' => sub { [$_[0]->_pathclass->lstat()] },
Subroutine __ANON__: not called CC=1 SCAR=6.9
26  
27 0 ▶ isdir => sub { false }, # Git doesn't store dirs, only files.
Subroutine __ANON__: not called CC=1 SCAR=6.9
28 0 ▶ name => sub { $_[0]->_pathclass->basename },
Subroutine __ANON__: not called CC=1 SCAR=6.9
29 0 ▶ path => sub { $_[0]->_pathclass->relative($_[0]->searchbase) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
30 1 };
31  
32 # Docs {{{1
33  
34 =head1 NAME
35  
36 # App::GitFind::Entry::GitIndex - App::GitFind::Entry wrapper for a Git::Raw::Index::Entry
37  
38 =head1 SYNOPSIS
39  
40 This represents a single file or directory being checked against an expression.
41 This particular concrete class represents a Git index entry.
42 It requires a L<Git::Raw::Index::Entry> instance. Usage:
43  
44 use Git::Raw 0.83;
45 my $index = Git::Raw::Repository->discover('.')->index;
46 my @entries = $index->entries;
47 my $entry = App::GitFind::Entry::GitIndex->new(-obj => $entries[0]);
48  
49 =head1 METHODS
50  
51 =cut
52  
53 # }}}1
54  
55 =head2 prune
56  
57 TODO
58  
59 =cut
60  
61 0 ▶sub prune {
Subroutine prune: not called CC=1 SCAR=6.9
Pod documented
62 ...
63 0 }
64  
65 =head2 BUILD
66  
67 Enforces the requirements on the C<-obj> argument to C<new()>.
68  
69 =cut
70  
71 0 ▶sub BUILD {
Subroutine BUILD: not called CC=5 SCAR=34.0
Pod documented
72 0 my $self = shift;
73 0 ▶ die "Usage: @{[ref $self]}->new(-obj=>..., -repo=>...)"
Branch: 1 branch
BranchTrueFalseTotal
unless $self->obj 0 0 0
74 unless $self->obj;
75 0 ▶ die "-obj must be a Git::Raw::Index::Entry"
Branch: 1 branch
BranchTrueFalseTotal
unless $self->obj->DOES("Git::Raw::Index::Entry") 0 0 0
76 unless $self->obj->DOES('Git::Raw::Index::Entry');
77 0 ▶ die "Usage: @{[ref $self]}->new(-repo=>..., -obj=>...)"
Branch: 1 branch
BranchTrueFalseTotal
unless $self->repo 0 0 0
78 unless $self->repo;
79 0 ▶ die "-repo must be a Git::Raw::Repository"
Branch: 1 branch
BranchTrueFalseTotal
unless $self->repo->DOES("Git::Raw::Repository") 0 0 0
80 unless $self->repo->DOES('Git::Raw::Repository');
81 } #BUILD()
82  
83 1 1;
« lib/App/GitFind/Searcher/FileSystem.pm ↑ Summary lib/App/GitFind/Actions.pm »