File Coverage

blib/lib/Boxer.pm
Criterion Covered Total %
statement 41 43 95.3
branch 3 4 75.0
condition 2 2 100.0
subroutine 12 12 100.0
pod 0 2 0.0
total 58 63 92.0


line stmt bran cond sub pod time code
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     5   5205 use v5.20;
  5         25  
12 5     5   29 use utf8;
  5         9  
  5         29  
13 5     5   1418 use Role::Commons -all;
  5         50151  
  5         32  
14 5     5   61505 use feature 'signatures';
  5         12  
  5         503  
15 5     5   1034 use namespace::autoclean 0.16;
  5         19789  
  5         28  
16              
17 5     5   2817 use Module::Find;
  5         7757  
  5         358  
18 5     5   2593 use Module::Load::Conditional qw(can_load);
  5         123692  
  5         337  
19 5     5   545 use Log::Any qw($log);
  5         8393  
  5         60  
20              
21 5     5   3342 use strictures 2;
  5         51  
  5         238  
22 5     5   1141 no warnings "experimental::signatures";
  5         12  
  5         1745  
23              
24             =head1 VERSION
25              
26             Version v1.4.1
27              
28             =cut
29              
30             our $VERSION = "v1.4.1";
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             sub list_worlds ($self)
63 11     11 0 1859 {
  11         24  
  11         26  
64 11         47 return findsubmod Boxer::World;
65             }
66              
67             sub get_world
68             {
69 10     10 0 23255 my ( $self, $name ) = @_;
70              
71 10   100     43 $name ||= 'flat';
72              
73 10         36 foreach my $world ( $self->list_worlds() ) {
74 14 100       17549 if ( lc( substr( $world, -( length($name) + 2 ) ) ) eq lc("::$name") )
75             {
76 9 50       63 unless ( can_load( modules => { $world => 0 } ) ) {
77 0         0 $log->error($Module::Load::Conditional::ERROR);
78 0         0 return;
79             }
80 9         6199 return $world;
81             }
82             }
83 1         20 $log->error("No world \"$name\" found");
84 1         75 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             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             1;