blib/lib/Tapper/CLI/Schema.pm

filter: Statementstmt 41.6% 15 / 36 Branchbran 10.0% 1 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 100% 2 / 2 totaltotal 41.5% 22 / 53 CC 6 SCAR 27.5
CC
6
Cov
35%
zipfiles
30.0
setup
2.1
BEGIN
1.0
CRAP 15.7
« blib/lib/Tapper/CLI/User.pm ↑ Summary blib/lib/Tapper/CLI/Scenario.pm »
1 package Tapper::CLI::Schema;
2 72 our $AUTHORITY = 'cpan:TAPPER';
3 72 $Tapper::CLI::Schema::VERSION = '5.0.8';
4 72 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 72 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 72 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8  
9 sub zipfiles
10 0 ▶{
Subroutine zipfiles: not called CC=5 SCAR=34.0
Pod documented
11 0 my ($c) = @_;
12 0 $c->getopt( 'quiet|q', 'help|?' );
13  
14 0 ▶ if ($c->options->{help} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->options->{"help"}) 0 0 0
15 0 say STDERR "Usage: $0 schema-zipfiles [ --quiet ]";
16 0 say STDERR "\n Optional arguments:";
17 0 say STDERR "\t--quiet\tPrint a dot instead of the file name of the updated file";
18 0 say STDERR "\t--help\t\tprint this help message and exit";
19 0 exit -1;
20 }
21  
22 0 require Compress::Bzip2;
23 0 require Tapper::Model;
24 0 my $uncompressed_files = Tapper::Model::model('TestrunDB')->resultset('ReportFile')->search({is_compressed => 0});
25 0 ▶ while (my $file = $uncompressed_files->next) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $file = $uncompressed_files->next) 0 0 0
26 0 my $compressed;
27 0 eval { $compressed = memBzip( $file->filecontent) };
28 0 ▶ if (defined $compressed) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $compressed) 0 0 0
29 0 ▶ print( $c->options->{quiet} ? '.' : "COMPRESS ".$file->report_id.":".$file->id.":".$file->filename."\n" );
Branch: 1 branch
BranchTrueFalseTotal
$c->options->{'quiet'} ? : 0 0 0
30 0 $file->set_column(filecontent => $compressed);
31 0 $file->is_compressed(1);
32 0 $file->update();
33 }
34 }
35 }
36  
37  
38  
39 sub setup
40 71 ▶{
Subroutine setup: called CC=2 SCAR=7.4
Pod documented
41 71 my ($c) = @_;
42 71 $c->register('schema-zipfiles', \&zipfiles, 'Compress all uncompressed files uploaded to reports framework');
43 71 ▶ if ($c->can('group_commands')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->can("group_commands")) 0 71 71
44 0 $c->group_commands('Schema commands', 'schema-zipfiles');
45 }
46 71 return;
47 }
48  
49 72 1; # End of Tapper::CLI
50  
51 __END__
« blib/lib/Tapper/CLI/User.pm ↑ Summary blib/lib/Tapper/CLI/Scenario.pm »