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

filter: Statementstmt 81.8% 18 / 22 Branchbran 37.5% 3 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 100% 3 / 3 totaltotal 73.6% 28 / 38 CC 5 SCAR 14.1
CC
5
Cov
70%
execute
6.4
abstract
2.0
BEGIN
1.0
CRAP 4.1
« blib/lib/Dist/Zilla/Plugin/GatherDir.pm ↑ Summary blib/lib/Dist/Zilla/Plugin/CPANFile.pm »
1 package Dist::Zilla::App::Command::build 6.040;
2 # ABSTRACT: build your dist
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 build [ --trial ] [ --tgz | --no-tgz ] [ --in /path/to/build/dir ]
11 #pod
12 #pod =head1 DESCRIPTION
13 #pod
14 #pod This command is a very thin layer over the Dist::Zilla C<build> method, which
15 #pod does all the things required to build your distribution. By default, it will
16 #pod also archive your distribution and leave you with a complete, ready-to-release
17 #pod distribution tarball.
18 #pod
19 #pod To go a bit further in depth, the C<build> command will do two things:
20 #pod
21 #pod =over
22 #pod
23 #pod =item
24 #pod
25 #pod Generate a directory containing your module, C<Foo-0.100>. This directory is
26 #pod complete. You could create a gzipped tarball from this directory and upload it
27 #pod directly to C<PAUSE> if you so desired. You could C<cd> into this directory and
28 #pod test your module on Perl installations where you don't have C<Dist::Zilla>, for
29 #pod example.
30 #pod
31 #pod This is a default behavior of the C<build> command. You can alter where it puts
32 #pod the directory with C<--in /path/to/build/dir>.
33 #pod
34 #pod =item
35 #pod
36 #pod Generate a gzipped tarball of your module, C<Foo-0.100.tar.gz>. This file
37 #pod could be uploaded directly to C<PAUSE> to make a release of your module if you
38 #pod wanted. Or, you can test your module: C<cpanm --test-only Foo-0.100.tar.gz>.
39 #pod This is the same thing you would get if you compressed the directory described
40 #pod above.
41 #pod
42 #pod The gzipped tarball is generated by default, but if you don't want it to be
43 #pod generated, you can pass the C<--no-tgz> option. In that case, it would only
44 #pod generate the directory described above.
45 #pod
46 #pod =back
47 #pod
48 #pod Once you're done testing or publishing your build, you can clean up everything
49 #pod with a C<dzil clean>.
50 #pod
51 #pod =cut
52  
53 0 ▶sub abstract { 'build your dist' }
Subroutine abstract: not called CC=1 SCAR=6.9
Pod documented
54  
55 #pod =head1 EXAMPLE
56 #pod
57 #pod $ dzil build
58 #pod $ dzil build --no-tgz
59 #pod $ dzil build --in /path/to/build/dir
60 #pod
61 #pod =cut
62  
63 1 ▶sub opt_spec {
Subroutine opt_spec: called CC=1 SCAR=0.0
Pod documented
64 1 [ 'trial' => 'build a trial release that PAUSE will not index' ],
65 [ 'tgz!' => 'build a tarball (default behavior)', { default => 1 } ],
66 [ 'in=s' => 'the directory in which to build the distribution' ]
67 }
68  
69 #pod =head1 OPTIONS
70 #pod
71 #pod =head2 --trial
72 #pod
73 #pod This will build a trial distribution. Among other things, it will generally
74 #pod mean that the built tarball's basename ends in F<-TRIAL>.
75 #pod
76 #pod =head2 --tgz | --no-tgz
77 #pod
78 #pod Builds a .tar.gz in your project directory after building the distribution.
79 #pod
80 #pod --tgz behaviour is by default, use --no-tgz to disable building an archive.
81 #pod
82 #pod =head2 --in
83 #pod
84 #pod Specifies the directory into which the distribution should be built. If
85 #pod necessary, the directory will be created. An archive will not be created.
86 #pod
87 #pod =cut
88  
89 1 ▶sub execute {
Subroutine execute: called CC=5 SCAR=18.5
Pod documented
90 1 my ($self, $opt, $args) = @_;
91  
92 1 ▶ if ($opt->in) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opt->in) { } 0 1 1
93 0 require Path::Tiny;
94 0 ▶ die qq{using "--in ." would destroy your working directory!\n}
Branch: 1 branch
BranchTrueFalseTotal
if Path::Tiny::path($opt->in)->absolute eq Path::Tiny::path(".")->absolute 0 0 0
95 if Path::Tiny::path($opt->in)->absolute eq Path::Tiny::path('.')->absolute;
96  
97 0 $self->zilla->build_in($opt->in);
98 } else {
99 1 ▶ my $method = $opt->tgz ? 'build_archive' : 'build';
Branch: 1 branch
BranchTrueFalseTotal
$opt->tgz ? : 1 0 1
100 1 my $zilla;
101 {
102 # isolate changes to RELEASE_STATUS to zilla construction
103 1 local $ENV{RELEASE_STATUS} = $ENV{RELEASE_STATUS};
104 1 ▶ $ENV{RELEASE_STATUS} = 'testing' if $opt->trial;
Branch: 1 branch
BranchTrueFalseTotal
if $opt->trial 0 1 1
105 1 $zilla = $self->zilla;
106 }
107 1 $zilla->$method;
108 }
109  
110 1 $self->zilla->log('built in ' . $self->zilla->built_in);
111 }
112  
113 4 1;
114  
115 __END__
« blib/lib/Dist/Zilla/Plugin/GatherDir.pm ↑ Summary blib/lib/Dist/Zilla/Plugin/CPANFile.pm »