« blib/lib/App/Prove/Elasticsearch/Indexer/MMDist.pm
↑ Summary
blib/lib/App/Prove/Elasticsearch/Blamer/Git.pm »
| 1 | # ABSTRACT: Names your elasticsearch index after your distribution as defined in dist.ini | ||||||||||||
| 2 | # PODNAME: App::Prove::Elasticsearch::Indexer::DzilDist | ||||||||||||
| 3 | |||||||||||||
| 4 | package App::Prove::Elasticsearch::Indexer::DzilDist; | ||||||||||||
| 5 | 2 | $App::Prove::Elasticsearch::Indexer::DzilDist::VERSION = '0.001'; | |||||||||||
| 6 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 2 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | |||||||||||||
| 9 | 2 | ▶ | use parent qw{App::Prove::Elasticsearch::Indexer}; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | |||||||||||||
| 11 | #Basically, do this: | ||||||||||||
| 12 | #our $index = `awk '/^name/ {print \$NF}' dist.ini`; | ||||||||||||
| 13 | |||||||||||||
| 14 | 2 | our $index = __CLASS__->SUPER::index; | |||||||||||
| 15 | 2 | ▶ | our $dfile //= 'dist.ini'; | ||||||||||
|
Condition100%2/2
our $dfile //= "dist.ini"
MC/DC100%1/1
our $dfile //= "dist.ini"
our $dfile
Truth table100%2/2
A
A= our $dfile
| |||||||||||||
| 16 | |||||||||||||
| 17 | 2 | ▶ | if (open(my $dh, '<', $dfile)) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 18 | 1 | ▶ | while (<$dh>) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 19 | 8 | ($index) = $_ =~ /^name\s*?=\s*?(.*)/; | |||||||||||
| 20 | 8 | ▶ | if ($index) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 21 | 1 | $index =~ s/^\s+//; | |||||||||||
| 22 | 1 | last; | |||||||||||
| 23 | } | ||||||||||||
| 24 | } | ||||||||||||
| 25 | 1 | close $dh; | |||||||||||
| 26 | } else { | ||||||||||||
| 27 | 1 | ||||||||||||
| 28 | "# WARNING: Could not open $dfile, falling back to index name '$index'\n"; | ||||||||||||
| 29 | } | ||||||||||||
| 30 | |||||||||||||
| 31 | 2 | 1; | |||||||||||
| 32 | |||||||||||||
| 33 | __END__ | ||||||||||||