File Coverage

blib/lib/Dist/Zilla/App/Command/update.pm
Criterion Covered Total %
statement 9 21 42.8
branch 0 2 0.0
condition 0 3 0.0
subroutine 3 6 50.0
pod 3 3 100.0
total 15 35 42.8


line stmt bran cond sub pod time code
1             package Dist::Zilla::App::Command::update;
2              
3 1     1   12431 use strict;
  1         1  
  1         22  
4 1     1   2 use warnings;
  1         1  
  1         31  
5             our $VERSION = '0.06';
6              
7 1     1   399 use Dist::Zilla::App -command;
  1         30896  
  1         10  
8              
9 0     0 1   sub abstract { "update generated files by building and then removing the build" }
10              
11             sub opt_spec {
12 0     0 1   [ 'trial' => 'build a trial release' ],
13             }
14              
15             sub execute {
16 0     0 1   my ($self, $opt) = @_;
17 0           my $zilla;
18             {
19 0 0         local $ENV{TRIAL} = $opt->trial ? 1 : 0;
  0            
20 0           $zilla = $self->zilla;
21             }
22 0           $self->log("update: building into tmpdir");
23 0           my ($built_in) = $self->zilla->ensure_built_in_tmpdir;
24 0           $self->log("update: removing $built_in");
25 0   0       my $rmtree = $built_in->can("remove_tree") # ≥ 6.000 is Path::Tiny
26             || $built_in->can("rmtree"); # < 6.000 is Path::Class::Dir
27 0           $rmtree->($built_in);
28             }
29              
30             1;
31             __END__
32              
33             =encoding utf-8
34              
35             =head1 NAME
36              
37             Dist::Zilla::App::Command::update - A Dist::Zilla (and hence Dist::Milla)
38             command to update generated files
39              
40             =head1 SYNOPSIS
41              
42             $ dzil update [--trial]
43             $ milla update # my use case
44              
45             =head1 DESCRIPTION
46              
47             This command is approximated by
48              
49             $ dzil build --no-tgz [--trial]
50             $ rm -rf Your-Package-x.yz/
51              
52             but it builds inside a temporary directory. If you've ever used C<dzil build
53             && dzil clean> to update generated files, now you can use C<dzil update>.
54             That's all!
55              
56             =head1 OPTIONS
57              
58             =head2 --trial
59              
60             Build a trial release, as if C<dzil build> was called with --trial.
61              
62             =head1 AUTHOR
63              
64             Thomas Sibley E<lt>tsibley@cpan.orgE<gt>
65              
66             =head1 COPYRIGHT
67              
68             Copyright 2014- Thomas Sibley
69              
70             =head1 LICENSE
71              
72             This library is free software; you can redistribute it and/or modify
73             it under the same terms as Perl itself.
74              
75             =head1 SEE ALSO
76              
77             L<dzil>
78              
79             L<Dist::Zilla>
80              
81             L<milla>
82              
83             L<Dist::Milla>
84              
85             =cut