blib/lib/Dist/Zilla/App/Command/run.pm

filter: Statementstmt 36.8% 7 / 19 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 28.5% 2 / 7 Podpod 100% 5 / 5 totaltotal 37.8% 14 / 37 CC 4 SCAR 22.0
CC
4
Cov
28%
execute
20.0
abstract
2.0
opt_spec
2.0
CRAP 9.0
« blib/lib/Dist/Zilla/MVP/Reader/Perl.pm ↑ Summary blib/lib/Dist/Zilla/Plugin/Prereqs.pm »
1 package Dist::Zilla::App::Command::run 6.040;
2 # ABSTRACT: run stuff in a dir where your dist is built
3  
4 4 ▶use Dist::Zilla::Pragmas;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use Dist::Zilla::App -command;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 #pod =head1 SYNOPSIS
9 #pod
10 #pod $ dzil run ./bin/myscript
11 #pod $ dzil run prove -bv t/mytest.t
12 #pod $ dzil run bash
13 #pod
14 #pod =head1 DESCRIPTION
15 #pod
16 #pod This command will build your dist with Dist::Zilla, then build the
17 #pod distribution and then run a command in the build directory. It's something
18 #pod like doing this:
19 #pod
20 #pod dzil build
21 #pod rsync -avp My-Project-version/ .build/
22 #pod cd .build
23 #pod perl Makefile.PL # or perl Build.PL
24 #pod make # or ./Build
25 #pod export PERL5LIB=$PWD/blib/lib:$PWD/blib/arch
26 #pod <your command as defined by rest of params>
27 #pod
28 #pod Except for the fact it's built directly in a subdir of .build (like
29 #pod F<.build/69105y2>).
30 #pod
31 #pod A command returning with an non-zero error code will left the build directory
32 #pod behind for analysis, and C<dzil> will exit with a non-zero status. Otherwise,
33 #pod the build directory will be removed and dzil will exit with status zero.
34 #pod
35 #pod If no run command is provided, a new default shell is invoked. This can be
36 #pod useful for testing your distribution as if it were installed.
37 #pod
38 #pod =cut
39  
40 0 ▶sub abstract { 'run stuff in a dir where your dist is built' }
Subroutine abstract: not called CC=1 SCAR=6.9
Pod documented
41  
42 0 ▶sub opt_spec {
Subroutine opt_spec: not called CC=1 SCAR=6.9
Pod documented
43 0 [ 'build!' => 'do the Build actions before running the command; done by default',
44 { default => 1 } ],
45 [ 'trial' => 'build a trial release that PAUSE will not index' ],
46 }
47  
48 0 ▶sub description {
Subroutine description: not called CC=1 SCAR=6.9
Pod documented
49 0 "This will build your dist and run the given 'command' in the build dir.\n" .
50 "If no command was specified, your shell will be run there instead."
51 }
52  
53 0 ▶sub usage_desc {
Subroutine usage_desc: not called CC=1 SCAR=6.9
Pod documented
54 0 return '%c run %o [ command [ arg1 arg2 ... ] ]';
55 }
56  
57 0 ▶sub execute {
Subroutine execute: not called CC=4 SCAR=30.0
Pod documented
58 0 my ($self, $opt, $args) = @_;
59  
60 0 ▶ unless (@$args) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@$args) 0 0 0
61 0 ▶ my $envname = $^O eq 'MSWin32' ? 'COMSPEC' : 'SHELL';
Branch: 1 branch
BranchTrueFalseTotal
$^O eq 'MSWin32' ? : 0 0 0
62 0 ▶ unless ($ENV{$envname}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ENV{$envname}) 0 0 0
63 0 $self->usage_error("no command supplied to run and no \$$envname set");
64 }
65 0 $args = [ $ENV{$envname} ];
66 0 $self->log("no command supplied to run so using \$$envname: $args->[0]");
67 }
68  
69 0 $self->zilla->run_in_build($args, { build => $opt->build, trial => $opt->trial });
70 }
71  
72 4 1;
73  
74 __END__
« blib/lib/Dist/Zilla/MVP/Reader/Perl.pm ↑ Summary blib/lib/Dist/Zilla/Plugin/Prereqs.pm »