File Coverage

blib/lib/Siesta/Build.pm
Criterion Covered Total %
statement 18 62 29.0
branch 0 16 0.0
condition 0 3 0.0
subroutine 6 13 46.1
pod 0 5 0.0
total 24 99 24.2


line stmt bran cond sub pod time code
1 1     1   4458 use strict;
  1         2  
  1         41  
2             package Siesta::Build;
3 1     1   3428 use Module::Build;
  1         127403  
  1         10  
4 1     1   33 use File::Find qw(find);
  1         3  
  1         60  
5 1     1   6 use IO::File;
  1         2  
  1         183  
6 1     1   6 use base 'Module::Build';
  1         1  
  1         84  
7 1     1   5 use vars qw/$FAKE/;
  1         2  
  1         657  
8              
9             sub create_build_script {
10 0     0 0   my $self = shift;
11 0           $self->SUPER::create_build_script;
12              
13             # check for incompatible steps
14 0           my $module = $self->{properties}{module_name};
15 0 0         if (my $version = $self->check_installed_version($module, 0)) {
16 0           print "Upgrading from $module $version\n";
17 0           my $fh = IO::File->new('Changes');
18 0           my $chunk = '';
19 0           my $this;
20 0           while (<$fh>) {
21 0 0         if (/^(\S+)/) {
22 0 0         print "Incompatible change introduced in version $this:\n", $chunk
23             if $chunk =~ /INCOMPATIBLE/;
24 0           $this = $1;
25 0 0         last if $self->check_installed_version( $module, $this );
26 0           $chunk = '';
27             }
28 0           $chunk .= $_;
29             }
30             }
31             }
32              
33             sub ACTION_install {
34 0     0 0   my $self = shift;
35 0           $self->SUPER::ACTION_install;
36 0           $self->ACTION_install_extras;
37             }
38              
39             sub ACTION_fakeinstall {
40 0     0 0   my $self = shift;
41 0           $self->SUPER::ACTION_fakeinstall;
42 0           local $FAKE = 1;
43 0           $self->ACTION_install_extras;
44             }
45              
46             sub ACTION_install_extras {
47 0     0 0   my $self = shift;
48 0           my $path = $self->{config}{__extras_destination};
49 0           my @files = $self->_find_extras;
50 0           print "installing extras to $path\n";
51 0           for (@files) {
52 0 0         $FAKE
53             ? print "$_ -> $path/$_ (FAKE)\n"
54             : $self->copy_if_modified($_, $path);
55             }
56             }
57              
58             sub ACTION_cover {
59 0     0 0   my $self = shift;
60 0           $self->depends_on('build');
61 0           system qw( cover -delete );
62              
63             # sometimes we get failing tests, which makes Test::Harness
64             # die. catch that
65 0           eval {
66 0           local $ENV{PERL5OPT} = "-MDevel::Cover=-summary,0";
67 0           $self->ACTION_test(@_);
68             };
69 0           system qw( cover -report html );
70             }
71              
72             sub _find_extras {
73 0     0     my $self = shift;
74 0           my @files;
75             find(sub {
76 0 0 0 0     $File::Find::prune = 1 if -d && /^\.svn$/;
77 0 0         return if -d;
78 0 0         return if /~$/;
79 0           push @files, $File::Find::name;
80 0           }, @{ $self->{config}{__extras_from} });
  0            
81 0           return @files;
82             }
83              
84             1;