Boxer/CLI/Command/Compose.pm

filter: Statementstmt 97.6% 41 / 42 Branchbran 50.0% 1 / 2 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 93.3% 14 / 15 Podpod 100% 4 / 4 totaltotal 95.4% 63 / 66 CC 4 SCAR 5.5
CC
4
Cov
96%
execute
4.0
description
2.0
BEGIN
1.0
CRAP 1.7
« Boxer/Task/Serialize.pm ↑ Summary Boxer/World/Flat.pm »
1 package Boxer::CLI::Command::Compose;
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 Module::Runtime qw/use_module/;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 3 ▶use Boxer::CLI -command;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 3 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 3 ▶no warnings "experimental::signatures";
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 =head1 VERSION
21  
22 Version v1.4.3
23  
24 =cut
25  
26 3 our $VERSION = "v1.4.3";
27  
28 3 ▶use constant {
Subroutine BEGIN: called CC=1 SCAR=0.0
29 3 abstract => q[compose system recipe from abstract node],
30 usage_desc => q[%c compose %o NODE [NODE...]],
31 3 };
32  
33 sub description
34 0 ▶{
Subroutine description: not called CC=1 SCAR=6.9
Pod documented
35 0 <<'DESCRIPTION';
36 Compose a system recipe.
37  
38 Resolve a recipe to build a system. Input is one or more abstract nodes
39 to resolve using a set of abstract classes, and output is one or more
40 recipies serialized in one or more formats.
41  
42 DESCRIPTION
43 }
44  
45 sub command_names
46 5 ▶{
Subroutine command_names: called CC=1 SCAR=0.0
Pod documented
47 5 qw(
48 compose
49 );
50 }
51  
52 sub opt_spec
53 3 ▶{
Subroutine opt_spec: called CC=1 SCAR=0.0
Pod documented
54 return (
55 3 [ "suite=s", "suite of classes to use (bullseye)" ],
56 [ "nodedir=s", "location of nodes (current dir)" ],
57 [ "classdir=s", "location of classes (XDG datadir + suite/classes)" ],
58 [ "datadir=s", "location containing nodes and classes" ],
59 [ "skeldir=s", "location of skeleton files (use builtin)" ],
60 [ "format=s", "serialize into these formats (preseed script)" ],
61 [ "nonfree", "enable use of contrib and non-free code" ],
62 [ "verbose|v", "verbose output" ],
63 );
64 }
65  
66 3 ▶sub execute ( $self, $opt, $args )
Subroutine execute: called CC=4 SCAR=13.9
Pod documented
67 {
68 Log::Any::Adapter->set( 'Screen', default_level => 'info' )
69 3 ▶ if ( $opt->{verbose} );
Branch: 1 branch
BranchTrueFalseTotal
if $opt->{"verbose"} 0 3 3
70  
71 my $world = use_module('Boxer::Task::Classify')->new(
72 suite => $opt->{suite},
73 nodedir => $opt->{nodedir},
74 classdir => $opt->{classdir},
75 datadir => $opt->{datadir},
76 3 )->run;
77 3 for my $node (@$args) {
78 use_module('Boxer::Task::Serialize')->new(
79 world => $world,
80 skeldir => $opt->{skeldir},
81 format => $opt->{format} || 'preseed script',
82 nonfree => $opt->{nonfree},
83 3 ▶ node => $node,
Condition100%2/2
$opt->{'format'} || 'preseed script'
l!l
21
MC/DC100%1/1
$opt->{'format'} || 'preseed script'
$opt->{'format'}
Truth table100%2/2
A
A= $opt->{'format'}
Aresult
11
00
84 )->run;
85 }
86 }
87  
88 =head1 AUTHOR
89  
90 Jonas Smedegaard C<< <dr@jones.dk> >>.
91  
92 =cut
93  
94 3 our $AUTHORITY = 'cpan:JONASS';
95  
96 =head1 COPYRIGHT AND LICENCE
97  
98 Copyright © 2013-2016 Jonas Smedegaard
99  
100 This is free software; you can redistribute it and/or modify it under
101 the same terms as the Perl 5 programming language system itself.
102  
103 =head1 DISCLAIMER OF WARRANTIES
104  
105 THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
106 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
107 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
108  
109 =cut
110  
111 3 1;
« Boxer/Task/Serialize.pm ↑ Summary Boxer/World/Flat.pm »