blib/lib/UR/ModuleBuild.pm untested

filter: Statementstmt 0.0% 0 / 43 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 4 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 64 SCAR 30.0
CC
4
Cov
0%
ACTION_ur_docs
20.0
ACTION_clean
2.0
ACTION_docs
2.0
CRAP 20.0
1 package UR::ModuleBuild;
2 use strict;
3 use warnings;
4 use base 'Module::Build';
5  
6 sub ACTION_clean {
7 # FIXME: is this safe?
8 use File::Path qw/rmtree/;
9 rmtree "./_build";
10 rmtree "./blib";
11 unlink "./Build";
12 unlink "./MYMETA.yml";
13 }
14  
15 our $ns = 'UR';
16 our $cmd_class = 'UR::Namespace::Command';
17  
18 sub ACTION_ur_docs {
19 # We want to use UR to autodocument our code. This is done
20 # with module introspection and requires some namespace hackery
21 # to work. ./Build doc comes after ./Build and copies the root
22 # namespace module into ./blib to fake a Genome namespace so this will work.
23 use File::Copy qw/copy/;
24 $ENV{ANSI_COLORS_DISABLED} = 1;
25
26 eval {
27 my $oldpwd = $ENV{PWD};
28  
29 unshift @INC, "$ENV{PWD}/blib/lib";
30  
31 my ($namespace_src_dr) = grep { -s "$_/$ns.pm" } @INC;
32 unless ($namespace_src_dr) {
33 die "Failed to find $ns.pm in \@INC.\n";
34 }
35  
36 chdir "$ENV{PWD}/blib/lib/$ns" || die "Can't find $ns/";
37 unless (-e "../$ns.pm") {
38 copy "$namespace_src_dr/$ns.pm", "../$ns.pm" || die "Can't find $ns.pm";
39 }
40  
41 eval "use $ns";
42 $cmd_class->class();
43  
44 UR::Namespace::Command::Update::Pod->execute(
45 base_commands => [ $cmd_class ],
46 );
47 # We need to move back for perl install to find ./lib
48 chdir $oldpwd;
49 };
50  
51 die "failed to extract pod: $!: $@" if ($@);
52 }
53  
54 sub ACTION_docs {
55 my $self = shift;
56 $self->depends_on('ur_docs');
57 $self->depends_on('code');
58 $self->depends_on('manpages', 'html');
59 }
60  
61  
62  
63 1;
64 __END__