File Coverage

_build/lib/MyModuleBuilder.pm
Criterion Covered Total %
statement 16 66 24.2
branch 1 14 7.1
condition 0 19 0.0
subroutine 5 11 45.4
pod 0 7 0.0
total 22 117 18.8


line stmt bran cond sub pod time code
1             package MyModuleBuilder;
2 1     1   610 use Module::Build;
  1         77888  
  1         42  
3             @ISA = qw(Module::Build);
4 1     1   440 use File::stat;
  1         6781  
  1         4  
5 1     1   74 use File::Basename;
  1         2  
  1         89  
6 1     1   576 use ExtUtils::Install;
  1         14036  
  1         744  
7              
8             sub process_elc_files {
9 0     0 0 0 my $self = shift;
10 0 0       0 if ( exists $self->{args}{noelc} ) {
11 0         0 return;
12             }
13             # Files to ignore byte-compile
14 0         0 my @ignore = qw(pde-load.el pde-loaddefs.el pde-patch.el);
15 0         0 my @el = glob("lisp/*.el");
16 0         0 foreach my $el ( @el ) {
17 0 0       0 next if grep { basename($el) eq $_ } @ignore;
  0         0  
18 0         0 my $elc = $el."c";
19 0 0 0     0 unless ( -e $elc && stat($elc)->mtime > stat($el)->mtime ) {
20 0         0 my $cmd = qq/emacs -q -batch --no-site-file --eval="(setq load-path (append load-path '(\\".\\" \\"contrib\\")))" -f batch-byte-compile $el/;
21 0         0 print $cmd, "\n";
22 0         0 system($cmd);
23             }
24             }
25 0         0 unlink("lisp/tools/perldoc-cache.el");
26             }
27              
28             sub ACTION_test {
29 1     1 0 2150 my ($emacs_version) = `emacs --version`;
30 1 50       149 if ( $emacs_version =~ /GNU Emacs/ ) {
31 0 0       0 if ( $emacs_version =~ /2[23]/ ) {
32 0         0 print "Seem everything is Ok\n";
33             } else {
34 0         0 print "Your emacs version is too low, PDE may not work. Consider upgrade it.\n"
35             }
36             }
37             else {
38 1         120 print "No emacs found in your system.\n";
39             }
40 1         34 return 1;
41             }
42              
43             sub ACTION_fakeinstall {
44 0     0 0   my $self = shift;
45 0           $self->SUPER::ACTION_install(@_);
46 0           my $home = $ENV{HOME};
47 0   0       my $elispdir = $self->{args}{elispdir} || "$home/.emacs.d/pde";
48             ExtUtils::Install::install( {lisp => $elispdir}, !$self->quiet, 1,
49 0   0       $self->{args}{uninst} || 0 );
50             }
51              
52             sub ACTION_install {
53 0     0 0   my $self = shift;
54 0           $self->SUPER::ACTION_install(@_);
55 0           my $home = $ENV{HOME};
56 0   0       my $elispdir = $self->{args}{elispdir} || "$home/.emacs.d/pde";
57             ExtUtils::Install::install( {lisp => $elispdir}, !$self->quiet, 0,
58 0   0       $self->{args}{uninst} || 0 );
59             }
60              
61             sub ACTION_info {
62 0     0 0   my $self = shift;
63 0           my $texi = "lisp/doc/pde.texi";
64 0           my $info = "lisp/doc/pde.info";
65 0 0 0       if ( !-e $info || stat($texi)->mtime > stat($info)->mtime ) {
66 0           print qq/makeinfo --fill-column=70 $texi\n/;
67 0           system("makeinfo", "--fill-column=70", "-o", $info, $texi);
68             }
69             else {
70 0           print "$info is already updated to date\n";
71             }
72 0           return;
73             }
74              
75             sub ACTION_disthtml {
76 0     0 0   my $self = shift;
77 0           my $html = 'lisp/doc/pde.html';
78 0           my $htmldir = 'lisp/doc/pde';
79 0           my $texi = "lisp/doc/pde.texi";
80 0 0 0       if ( !-e $html || stat($texi)->mtime > stat($html)->mtime ) {
81 0           print qq/makeinfo --no-split --html -o $html $texi\n/;
82 0           system("makeinfo", "--no-split", "--html", "-o", $html, $texi);
83 0           print qq/makeinfo --html -o $htmldir $texi\n/;
84 0           system("makeinfo", "--html", "-o", $htmldir, $texi);
85             }
86             else {
87 0           print "html documents is updated to date.\n";
88             }
89 0           return;
90             }
91              
92             sub ACTION_dist {
93 0     0 0   my $self = shift;
94 0           $self->depends_on('info');
95 0           $self->depends_on('disthtml');
96 0           return $self->SUPER::ACTION_dist(@_);
97             }
98              
99             1;