Boxer/World/Flat.pm

filter: Statementstmt 100% 78 / 78 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 14 / 14 Podpod 0.0% 0 / 1 totaltotal 98.9% 94 / 95 CC 3 SCAR 3.2
CC
3
Cov
100%
as_file
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
« Boxer/CLI/Command/Compose.pm ↑ Summary Boxer/Task/Classify.pm »
1 package Boxer::World::Flat;
2  
3 =encoding UTF-8
4  
5 =head1 NAME
6  
7 Boxer::World::Flat - software for single use case
8  
9 =cut
10  
11 6 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 6 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 6 ▶use Role::Commons -all;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 6 ▶use feature 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
15 6 ▶use namespace::autoclean 0.16;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 6 ▶use autodie;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 6 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 6 ▶use MooX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 6 extends qw(Boxer::World);
21  
22 6 ▶use Types::Standard qw( Maybe Bool Tuple );
Subroutine BEGIN: called CC=1 SCAR=0.0
23 6 ▶use Types::TypeTiny qw( StringLike ArrayLike );
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 6 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 6 ▶no warnings "experimental::signatures";
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 =head1 VERSION
29  
30 Version v1.4.3
31  
32 =cut
33  
34 6 our $VERSION = "v1.4.3";
35  
36 =head1 DESCRIPTION
37  
38 Outside the box is a world of software.
39  
40 B<Boxer::World::Flat> is a class describing a collection of software
41 available for installation into (or as) an operating system.
42  
43 =head1 SEE ALSO
44  
45 L<Boxer>.
46  
47 =cut
48  
49 has parts => (
50 is => 'ro',
51 isa => Tuple [],
52 6 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
53 6 );
54  
55 6 has node => (
56 is => 'ro',
57 isa => StringLike,
58 required => 1,
59 );
60  
61 6 has epoch => (
62 is => 'ro',
63 isa => Maybe [StringLike],
64 );
65  
66 6 has pkgs => (
67 is => 'ro',
68 isa => ArrayLike,
69 required => 1,
70 );
71  
72 6 has pkgs_auto => (
73 is => 'ro',
74 isa => ArrayLike,
75 required => 1,
76 );
77  
78 6 has pkgs_avoid => (
79 is => 'ro',
80 isa => ArrayLike,
81 required => 1,
82 );
83  
84 6 has tweaks => (
85 is => 'ro',
86 isa => ArrayLike,
87 required => 1,
88 );
89  
90 6 has pkgdesc => (
91 is => 'ro',
92 isa => StringLike,
93 required => 1,
94 );
95  
96 6 has tweakdesc => (
97 is => 'ro',
98 isa => StringLike,
99 required => 1,
100 );
101  
102 6 has nonfree => (
103 is => 'ro',
104 isa => Bool,
105 required => 1,
106 );
107  
108 8 ▶sub as_file ( $self, $file, $oldstyle = 0 )
Subroutine as_file: called CC=3 SCAR=11.0
Pod undocumented
109 {
110 8 my $pkgs = join( ',', sort @{ $self->pkgs } );
111 8 my $pkgs_avoid = join( ',', sort @{ $self->pkgs_avoid } );
112 8 my $pkgs_auto = join( ',', sort @{ $self->pkgs_auto } );
113 8 my $tweaks = join( ";\\\n ", @{ $self->tweaks } );
114  
115 8 my $pkglist = join( ' ', sort @{ $self->pkgs } );
116 8 $pkglist .= " \\\n ";
117 8 $pkglist .= join( ' ', sort map { $_ . '-' } @{ $self->pkgs_avoid } );
118 8 my $pkgautolist = join( ' ', sort @{ $self->pkgs_auto } );
119  
120 8 my $tweaks_perl = $tweaks;
121 8 $tweaks_perl =~ s,chroot\s+/target\s+,,g;
122 8 $tweaks_perl =~ s,/target/,/,g;
123  
124 # TODO: maybe move below (or only $''{ part?) to reclass parser
125 8 $tweaks_perl =~ s/\\\K''(?=n)|\$\K''(?=\{)//g;
126  
127 8 my %vars = (
128 node => $self->node,
129 suite => $self->epoch,
130 pkgs => $pkgs,
131 pkgs_avoid => $pkgs_avoid,
132 pkgs_auto => $pkgs_auto,
133 pkgdesc => $self->pkgdesc,
134 pkglist => $pkglist,
135 tweakdesc => $self->tweakdesc,
136 tweaks => $tweaks,
137 tweaks_perl => $tweaks_perl,
138 tweaklist => $tweaks,
139 pkgautolist => $pkgautolist,
140 nonfree => $self->nonfree,
141 );
142  
143 # TODO: Drop oldstyle templating format
144 # (oldstyle preseed templates expect perl tweaks in regular tweaks string)
145 8 ▶ if ($oldstyle) {
Branch: 1 branch
BranchTrueFalseTotal
if ($oldstyle) { } 4 4 8
146 4 my %altvars = %vars;
147 4 $altvars{tweaklist} = $tweaks_perl;
148 4 $file->create( \%altvars );
149 }
150 else {
151 4 $file->create( \%vars );
152 }
153  
154 8 1;
155 }
156  
157 =head1 AUTHOR
158  
159 Jonas Smedegaard C<< <dr@jones.dk> >>.
160  
161 =cut
162  
163 6 our $AUTHORITY = 'cpan:JONASS';
164  
165 =head1 COPYRIGHT AND LICENCE
166  
167 Copyright © 2013-2016 Jonas Smedegaard
168  
169 This is free software; you can redistribute it and/or modify it under
170 the same terms as the Perl 5 programming language system itself.
171  
172 =head1 DISCLAIMER OF WARRANTIES
173  
174 THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
175 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
176 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
177  
178 =cut
179  
180 6 1;
« Boxer/CLI/Command/Compose.pm ↑ Summary Boxer/Task/Classify.pm »