Boxer/CLI/Command/Bootstrap.pm

filter: Statementstmt 76.4% 39 / 51 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 72.2% 13 / 18 Podpod 100% 4 / 4 totaltotal 71.7% 56 / 78 CC 4 SCAR 15.7
CC
4
Cov
71%
execute
20.0
description
2.0
opt_spec
2.0
CRAP 4.8
« Boxer/CLI/Command/Aliases.pm ↑ Summary Boxer/File/WithSkeleton.pm »
1 package Boxer::CLI::Command::Bootstrap;
2  
3 =encoding UTF-8
4  
5 =cut
6  
7 3 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use Role::Commons -all;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 ▶use feature 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use namespace::autoclean 0.16;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 3 ▶use Path::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 3 ▶use List::MoreUtils qw(before after);
Subroutine BEGIN: called CC=1 SCAR=0.0
15 3 ▶use Module::Runtime qw/use_module/;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 3 ▶use Boxer::CLI -command;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 3 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 3 ▶no warnings "experimental::signatures";
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 =head1 VERSION
22  
23 Version v1.4.3
24  
25 =cut
26  
27 3 our $VERSION = "v1.4.3";
28  
29 3 ▶use constant {
Subroutine BEGIN: called CC=1 SCAR=0.0
30 3 abstract => q[bootstrap system image from abstract node],
31 usage_desc => q[%c bootstrap %o NODE [NODE...] [-- helper-options]],
32 3 };
33  
34 sub description
35 0 ▶{
Subroutine description: not called CC=1 SCAR=6.9
Pod documented
36 0 <<'DESCRIPTION';
37 Bootstrap a system image.
38  
39 Generate a filesystem image. Input is one or more abstract nodes
40 to resolve using a set of abstract classes, and output is one or more
41 images generated using a bootstrapping tool.
42  
43 DESCRIPTION
44 }
45  
46 sub command_names
47 5 ▶{
Subroutine command_names: called CC=1 SCAR=0.0
Pod documented
48 5 qw(
49 bootstrap
50 );
51 }
52  
53 sub opt_spec
54 0 ▶{
Subroutine opt_spec: not called CC=1 SCAR=6.9
Pod documented
55 return (
56 0 [ "suite=s", "suite of classes to use (buster)" ],
57 [ "nodedir=s", "location of nodes (current dir)" ],
58 [ "classdir=s", "location of classes (XDG datadir + suite/classes)" ],
59 [ "datadir=s", "location containing nodes and classes" ],
60 [ "skeldir=s", "location of skeleton files (use builtin)" ],
61 [ "mode=s", "mode passed to helper, and use sudo in sudo mode" ],
62 [ "helper=s", "bootstrapping tool to use (mmdebstrap)" ],
63 [ "nonfree", "enable use of contrib and non-free code" ],
64 [ "dryrun", "only echo command, without executing it" ],
65 [ "verbose|v", "verbose output" ],
66 );
67 }
68  
69 0 ▶sub execute ( $self, $opt, $args )
Subroutine execute: not called CC=4 SCAR=30.0
Pod documented
70 {
71 Log::Any::Adapter->set( 'Screen', default_level => 'info' )
72 0 ▶ if ( $opt->{verbose} );
Branch: 1 branch
BranchTrueFalseTotal
if $opt->{"verbose"} 0 0 0
73  
74 0 ▶ my @args = before { $_ eq '--' } @{$args};
Subroutine __ANON__: not called CC=1 SCAR=6.9
75 0 ▶ my @helper_args = after { $_ eq '--' } @{$args};
Subroutine __ANON__: not called CC=1 SCAR=6.9
76  
77 my $world = use_module('Boxer::Task::Classify')->new(
78 suite => $opt->{suite},
79 nodedir => $opt->{nodedir},
80 classdir => $opt->{classdir},
81 datadir => $opt->{datadir},
82 0 )->run;
83 0 for my $node (@args) {
84 use_module('Boxer::Task::Bootstrap')->new(
85 world => $world,
86 helper => $opt->{helper} || 'mmdebstrap',
87 mode => $opt->{mode},
88 helper_args => [@helper_args],
89 nonfree => $opt->{nonfree},
90 dryrun => $opt->{dryrun},
91 0 ▶ node => $node,
Condition0%0/2
$opt->{'helper'} || 'mmdebstrap'
l!l
00
MC/DC0%0/1
$opt->{'helper'} || 'mmdebstrap'
$opt->{'helper'}
Truth table0%0/2
A
A= $opt->{'helper'}
Aresult
11
00
92 )->run;
93 }
94 }
95  
96 =head1 AUTHOR
97  
98 Jonas Smedegaard C<< <dr@jones.dk> >>.
99  
100 =cut
101  
102 3 our $AUTHORITY = 'cpan:JONASS';
103  
104 =head1 COPYRIGHT AND LICENCE
105  
106 Copyright © 2019 Jonas Smedegaard
107  
108 This is free software; you can redistribute it and/or modify it under
109 the same terms as the Perl 5 programming language system itself.
110  
111 =head1 DISCLAIMER OF WARRANTIES
112  
113 THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
114 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
115 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
116  
117 =cut
118  
119 3 1;
« Boxer/CLI/Command/Aliases.pm ↑ Summary Boxer/File/WithSkeleton.pm »