« blib/lib/Module/CPANTS/ProcessCPAN/ConfigData.pm
↑ Summary
blib/lib/Module/CPANTS/Schema/Dist.pm »
| 1 | package Module::CPANTS::MyBuild; | ||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 1 | ▶ | use base qw(Module::Build); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | 1 | ▶ | use File::Copy; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 6 | 1 | ▶ | use File::HomeDir; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 7 | 1 | ▶ | use File::Spec::Functions qw(catdir catfile splitdir); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 8 | 1 | ▶ | use File::Find; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 9 | |||||||||||||||
| 10 | 0 | ▶ | sub ACTION_install_cpants { | ||||||||||||
|
Subroutine
ACTION_install_cpants: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||
| 11 | 0 | my $self = shift; | |||||||||||||
| 12 | |||||||||||||||
| 13 | 0 | my $home; | |||||||||||||
| 14 | 0 | eval { require Module::CPANTS::ProcessCPAN::ConfigData }; | |||||||||||||
| 15 | 0 | ▶ | if ($@) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 16 | 0 | $home=$self->prompt("Cannot find CPANTS home dir from Module::CPANTS::ProcessCPAN::ConfigData.\nPlease specify the CPANTS home directory:", catdir(File::HomeDir->my_home,'cpants')); | |||||||||||||
| 17 | } | ||||||||||||||
| 18 | else { | ||||||||||||||
| 19 | 0 | $home=Module::CPANTS::ProcessCPAN::ConfigData->config('home'); | |||||||||||||
| 20 | } | ||||||||||||||
| 21 | |||||||||||||||
| 22 | 0 | local $> = $self->notes('uid'); | |||||||||||||
| 23 | |||||||||||||||
| 24 | 0 | @MyBuild::dirs_to_copy=(''); | |||||||||||||
| 25 | 0 | find(\&to_copy,'cpants'); | |||||||||||||
| 26 | |||||||||||||||
| 27 | # make directories | ||||||||||||||
| 28 | 0 | foreach my $dir (@MyBuild::dirs_to_copy) { | |||||||||||||
| 29 | 0 | my $realdir=catdir($home,$dir); | |||||||||||||
| 30 | 0 | ▶ | if (-d $realdir) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 31 | 0 | print "Skipping $realdir\n"; | |||||||||||||
| 32 | 0 | next; | |||||||||||||
| 33 | } | ||||||||||||||
| 34 | 0 | print "mkdir $realdir\n"; | |||||||||||||
| 35 | 0 | ▶ | mkdir($realdir) || die "Cannot mkdir $realdir: $!"; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 36 | } | ||||||||||||||
| 37 | |||||||||||||||
| 38 | # copy files | ||||||||||||||
| 39 | 0 | foreach my $file (@MyBuild::files_to_copy) { | |||||||||||||
| 40 | 0 | my $source=catdir('cpants',$file); | |||||||||||||
| 41 | 0 | my $target=catdir($home,$file); | |||||||||||||
| 42 | 0 | print "Copying $source -> $target\n"; | |||||||||||||
| 43 | 0 | ▶ | copy($source,$target) || die "Cannot copy $source -> $target: $!"; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 44 | } | ||||||||||||||
| 45 | |||||||||||||||
| 46 | 0 | return; | |||||||||||||
| 47 | } | ||||||||||||||
| 48 | |||||||||||||||
| 49 | 0 | ▶ | sub ACTION_install { | ||||||||||||
|
Subroutine
ACTION_install: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 50 | 0 | my $self = shift; | |||||||||||||
| 51 | |||||||||||||||
| 52 | 0 | $self->SUPER::ACTION_install; | |||||||||||||
| 53 | |||||||||||||||
| 54 | 0 | print <<EOMSG; | |||||||||||||
| 55 | |||||||||||||||
| 56 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||||||||||||||
| 57 | If you want to install the CPANTS application, run | ||||||||||||||
| 58 | ./Build install_cpants | ||||||||||||||
| 59 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||||||||||||||
| 60 | EOMSG | ||||||||||||||
| 61 | |||||||||||||||
| 62 | } | ||||||||||||||
| 63 | |||||||||||||||
| 64 | 0 | ▶ | sub to_copy { | ||||||||||||
|
Subroutine
to_copy: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||
| 65 | 0 | ▶ | return if /^\.+$/; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 66 | 0 | ▶ | return if $File::Find::name=~/\.svn/; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 67 | 0 | my @dir=splitdir($File::Find::dir); | |||||||||||||
| 68 | 0 | shift @dir; # remove 'cpants/' | |||||||||||||
| 69 | 0 | ▶ | if (-d) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 70 | 0 | push(@MyBuild::dirs_to_copy,catdir(@dir,$_)); | |||||||||||||
| 71 | } | ||||||||||||||
| 72 | elsif (-f) { | ||||||||||||||
| 73 | 0 | push(@MyBuild::files_to_copy,catfile(@dir,$_)); | |||||||||||||
| 74 | } | ||||||||||||||
| 75 | } | ||||||||||||||
| 76 | |||||||||||||||
| 77 | |||||||||||||||
| 78 | 1 | 1; | |||||||||||||