| 1 | package | ||||||||||||||||||||||||||||
| 2 | MyBuilder; | ||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings qw(FATAL all NONFATAL misc); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use File::Find; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use File::Basename (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use File::Path; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use base qw(Module::Build File::Spec); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use Module::CPANfile; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 0 | ▶ | sub lexpand { | ||||||||||||||||||||||||||
|
Subroutine
lexpand: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 14 | 0 | ▶ | return unless defined $_[0]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 15 | 0 | %{$_[0]}; | |||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 0 | ▶ | sub my_cpanfile_specs { | ||||||||||||||||||||||||||
|
Subroutine
my_cpanfile_specs: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 19 | 0 | my ($pack) = @_; | |||||||||||||||||||||||||||
| 20 | 0 | my $file = Module::CPANfile->load("cpanfile"); | |||||||||||||||||||||||||||
| 21 | 0 | my $prereq = $file->prereq_specs; | |||||||||||||||||||||||||||
| 22 | 0 | my %args; | |||||||||||||||||||||||||||
| 23 | 0 | %{$args{requires}} = lexpand($prereq->{runtime}{requires}); | |||||||||||||||||||||||||||
| 24 | 0 | foreach my $phase (qw/configure runtime build test/) { | |||||||||||||||||||||||||||
| 25 | 0 | %{$args{$phase . "_requires"}} = lexpand($prereq->{$phase}{requires}); | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | 0 | %{$args{recommends}} = (map {lexpand($prereq->{$_}{recommends})} | |||||||||||||||||||||||||||
| 28 | keys %$prereq); | ||||||||||||||||||||||||||||
| 29 | 0 | %args | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | # | ||||||||||||||||||||||||||||
| 33 | # To include yatt_dist as_is | ||||||||||||||||||||||||||||
| 34 | # | ||||||||||||||||||||||||||||
| 35 | 1 | ▶ | sub process_yatt_dist_files { | ||||||||||||||||||||||||||
|
Subroutine
process_yatt_dist_files: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 36 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 1 | $self->pm_files(\ my %pm_files); | |||||||||||||||||||||||||||
| 39 | 1 | $self->pod_files(\ my %pod_files); | |||||||||||||||||||||||||||
| 40 | 1 | $self->script_files(\ my %script_files); | |||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 1 | foreach my $desc ([pm => \%pm_files], [pod => \%pod_files]) { | |||||||||||||||||||||||||||
| 43 | 2 | my ($ext, $map) = @$desc; | |||||||||||||||||||||||||||
| 44 | 2 | my ($src, $dest) = ("Lite.$ext", "lib/YATT/Lite.$ext"); | |||||||||||||||||||||||||||
| 45 | 2 | $map->{$src} = $dest; | |||||||||||||||||||||||||||
| 46 | 2 | $self->_yatt_dist_ensure_blib_copied($src, $dest); | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | # Lite/ should go into blib/lib/YATT/Lite | ||||||||||||||||||||||||||||
| 50 | 142 | ▶ | find({no_chdir => 1, wanted => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||
| 51 | 142 | ▶ | return $self->prune if /^\.git|^lib$/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | 142 | ▶ | return if -d $_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | 124 | my $dest; | |||||||||||||||||||||||||||
| 54 | 124 | ▶ | if (/\.pm$/) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 55 | 79 | $dest = \%pm_files | |||||||||||||||||||||||||||
| 56 | } elsif (/\.pod$/) { | ||||||||||||||||||||||||||||
| 57 | 24 | $dest = \%pod_files | |||||||||||||||||||||||||||
| 58 | } else { | ||||||||||||||||||||||||||||
| 59 | 21 | return; | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | 103 | my $d = $dest->{$_} = "lib/YATT/$_"; | |||||||||||||||||||||||||||
| 62 | 103 | $self->_yatt_dist_ensure_blib_copied($_, $d); | |||||||||||||||||||||||||||
| 63 | 1 | }}, "Lite"); | |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | # scripts/ | ||||||||||||||||||||||||||||
| 66 | 32 | ▶ | find({no_chdir => 1, wanted => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||
| 67 | 32 | ▶ | return $self->prune if /^\.git|^lib$/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 68 | 32 | ▶ | return if -d $_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 69 | 27 | ▶ | return unless -x $_ and m{/yatt[^/]*$}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
-x $_ and m[/yatt[^/]*$]
MC/DC100%2/2
-x $_ and m[/yatt[^/]*$]
-x $_
m[/yatt[^/]*$]
Truth table100%3/3
A and B
A= -x $_B= m[/yatt[^/]*$]
| |||||||||||||||||||||||||||||
| 70 | 15 | my $d = $script_files{$_} = "bin/". File::Basename::basename($_); | |||||||||||||||||||||||||||
| 71 | 15 | $self->_yatt_dist_ensure_blib_copied($_, $d); | |||||||||||||||||||||||||||
| 72 | 1 | }}, 'scripts'); | |||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | # elisp/ also should go into blib/lib/YATT/ | ||||||||||||||||||||||||||||
| 75 | # XXX: This may be changed to blib/lib/YATT/Lite/ or somewhere else. | ||||||||||||||||||||||||||||
| 76 | 7 | ▶ | find({no_chdir => 1, wanted => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.1
| |||||||||||||||||||||||||||||
| 77 | 7 | ▶ | return $self->prune if /^\.git|^lib$/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 78 | 7 | ▶ | return if -d $_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 79 | 6 | ▶ | return unless m{\.el$}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 80 | 6 | my $d = $pm_files{$_} = "lib/YATT/$_"; | |||||||||||||||||||||||||||
| 81 | 6 | $self->_yatt_dist_ensure_blib_copied($_, $d); | |||||||||||||||||||||||||||
| 82 | 1 | }}, 'elisp'); | |||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 126 | ▶ | sub _yatt_dist_ensure_blib_copied { | ||||||||||||||||||||||||||
|
Subroutine
_yatt_dist_ensure_blib_copied: called CC=2 SCAR=7.4
| |||||||||||||||||||||||||||||
| 86 | 126 | my ($self, $from, $dest) = @_; | |||||||||||||||||||||||||||
| 87 | 126 | my $to = $self->catfile($self->blib, $dest); | |||||||||||||||||||||||||||
| 88 | 126 | ▶ | if ($ENV{DEBUG_BUILD}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 89 | 0 | print STDERR "$from => $to\n"; | |||||||||||||||||||||||||||
| 90 | } else { | ||||||||||||||||||||||||||||
| 91 | 126 | $self->copy_if_modified(from => $from, to => $to); | |||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 0 | ▶ | sub prune { | ||||||||||||||||||||||||||
|
Subroutine
prune: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 96 | 0 | $File::Find::prune = 1; | |||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | #======================================== | ||||||||||||||||||||||||||||
| 100 | # | ||||||||||||||||||||||||||||
| 101 | # To remove leading 'v' from dist_version. | ||||||||||||||||||||||||||||
| 102 | # | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 0 | ▶ | sub dist_version { | ||||||||||||||||||||||||||
|
Subroutine
dist_version: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 105 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 106 | 0 | ▶ | my $ver = $self->SUPER::dist_version | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 107 | or die "Can't detect dist_version"; | ||||||||||||||||||||||||||||
| 108 | 0 | $ver =~ s/^v//; | |||||||||||||||||||||||||||
| 109 | 0 | $ver; | |||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | 1 | 1; | |||||||||||||||||||||||||||
| 113 | __END__ | ||||||||||||||||||||||||||||