Boxer.pm

filter: Statementstmt 95.3% 41 / 43 Branchbran 75.0% 3 / 4 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 12 / 12 Podpod 0.0% 0 / 2 totaltotal 92.1% 59 / 64 CC 5 SCAR 8.3
CC
5
Cov
94%
get_world
5.2
BEGIN
1.0
BEGIN
1.0
CRAP 2.3
« Boxer/File/WithSkeleton.pm ↑ Summary Boxer/Task/Serialize.pm »
1 package Boxer;
2  
3 =encoding UTF-8
4  
5 =head1 NAME
6  
7 Boxer - system deployment ninja tricks
8  
9 =cut
10  
11 5 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 5 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 5 ▶use Role::Commons -all;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 5 ▶use feature 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
15 5 ▶use namespace::autoclean 0.16;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 5 ▶use Module::Find;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 5 ▶use Module::Load::Conditional qw(can_load);
Subroutine BEGIN: called CC=1 SCAR=0.0
19 5 ▶use Log::Any qw($log);
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 5 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 5 ▶no warnings "experimental::signatures";
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 =head1 VERSION
25  
26 Version v1.4.3
27  
28 =cut
29  
30 5 our $VERSION = "v1.4.3";
31  
32 =head1 SYNOPSIS
33  
34 use Boxer;
35  
36 my $domain = Boxer->get_world('Reclass')->new( suite => 'stretch', data => 'examples' );
37 say $domain->list_parts();
38  
39 my $goal = $domain->get_part('lxp5');
40 my $plan = $domain->map( $goal, 1 );
41 $plan->as_file( Boxer::File::WithSkeleton->new( basename => 'preseed.cfg' ) );
42  
43 my $serializer = Boxer::File::WithSkeleton->new( skeleton => 'script.sh.in' );
44 $plan->as_file( $serializer->file( 'script.sh', 1 ) );
45  
46 my $anothergoal = $domain->get_part('parl-greens');
47 my $anotherplan = $domain->map($anothergoal);
48 $anotherplan->as_file( $serializer->file( 'parl-greens.sh', 1 ) );
49  
50 my $newdomain = Boxer->get_world()->new( suite => 'buster', data => 'examples' );
51 my $plan_a = $newdomain->map($goal);
52 $plan_a->as_file( Boxer::File::WithSkeleton->new( basename => 'preseed_pure.cfg' ) );
53  
54 =head1 DESCRIPTION
55  
56 Framework for system deployment ninja tricks.
57  
58 See L<boxer> for further information.
59  
60 =cut
61  
62 11 ▶sub list_worlds ($self)
Subroutine list_worlds: called CC=1 SCAR=0.0
Pod undocumented
63 {
64 11 return findsubmod Boxer::World;
65 }
66  
67 sub get_world
68 10 ▶{
Subroutine get_world: called CC=5 SCAR=16.4
Pod undocumented
69 10 my ( $self, $name ) = @_;
70  
71 10 ▶ $name ||= 'flat';
Condition100%2/2
$name ||= "flat"
l!l
82
MC/DC100%1/1
$name ||= "flat"
$name
Truth table100%2/2
A
A= $name
Aresult
11
00
72  
73 10 foreach my $world ( $self->list_worlds() ) {
74 14 ▶ if ( lc( substr( $world, -( length($name) + 2 ) ) ) eq lc("::$name") )
Branch: 1 branch
BranchTrueFalseTotal
if (lc substr($world, -(length($name) + 2)) eq lc "::$name") 9 5 14
75 {
76 9 ▶ unless ( can_load( modules => { $world => 0 } ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (can_load("modules", {$world, 0})) 0 9 9
77 0 $log->error($Module::Load::Conditional::ERROR);
78 0 return;
79 }
80 9 return $world;
81 }
82 }
83 1 $log->error("No world \"$name\" found");
84 1 return;
85 }
86  
87 =head1 BUGS
88  
89 Please report any bugs to
90 L<http://rt.cpan.org/Dist/Display.html?Queue=Boxer>.
91  
92 =head1 SEE ALSO
93  
94 L<Debian Installer|https://www.debian.org/devel/debian-installer/>,
95 L<tasksel|https://www.debian.org/doc/manuals/debian-faq/ch-pkgtools.en.html#s-tasksel>,
96 L<debconf preseeding|https://wiki.debian.org/DebianInstaller/Preseed>,
97 L<Hands-off|http://hands.com/d-i/>
98  
99 L<Debian Pure Blends|https://wiki.debian.org/DebianPureBlends>
100  
101 L<Footprintless>
102  
103 L<FAI class system|https://fai-project.org/fai-guide/#defining%20classes>
104  
105 L<Elbe commands|https://elbe-rfs.org/docs/sphinx/elbe.html>
106  
107 L<isar|https://github.com/ilbers/isar>
108  
109 L<Debathena config-package-dev|https://debathena.mit.edu/config-packages/>
110  
111 L<germinate|https://wiki.ubuntu.com/Germinate>
112  
113 L<https://freedombox.org/>,
114 L<https://solidbox.org/>,
115 L<https://wiki.debian.org/Design>,
116 L<https://wiki.debian.org/DebianParl>,
117 L<http://box.redpill.dk/>
118  
119 =head1 AUTHOR
120  
121 Jonas Smedegaard C<< <dr@jones.dk> >>.
122  
123 =cut
124  
125 5 our $AUTHORITY = 'cpan:JONASS';
126  
127 =head1 COPYRIGHT AND LICENCE
128  
129 Copyright © 2013-2016 Jonas Smedegaard
130  
131 This is free software; you can redistribute it and/or modify it under
132 the same terms as the Perl 5 programming language system itself.
133  
134 =head1 DISCLAIMER OF WARRANTIES
135  
136 THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
137 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
138 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
139  
140 =cut
141  
142 5 1;
« Boxer/File/WithSkeleton.pm ↑ Summary Boxer/Task/Serialize.pm »