TaskPipe/Plan.pm

filter: Statementstmt 92.0% 46 / 50 Branchbran n/a Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 92.3% 12 / 13 Podpod 0.0% 0 / 2 totaltotal 84.2% 59 / 70 CC 2 SCAR 2.0
CC
2
Cov
89%
load_content
2.0
run
2.0
BEGIN
1.0
CRAP 1.2
« TaskPipe/Tool/Command_StopJob.pm ↑ Summary TaskPipe/PathSettings/Global.pm »
1 package TaskPipe::Plan;
2  
3 37 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 37 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 37 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 37 ▶use TaskPipe::Task;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 37 ▶use TaskPipe::PathSettings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 37 ▶use TaskPipe::Plan::Settings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 37 with 'MooseX::ConfigCascade';
10 37 with 'TaskPipe::Role::MooseType_PlanMode';
11  
12 has settings => (is => 'rw', isa => __PACKAGE__.'::Settings', default => sub{
13 301 ▶ my $module = __PACKAGE__.'::Settings';
Subroutine __ANON__: called CC=1 SCAR=0.0
14 301 $module->new;
15 37 });
16 has path_settings => (is => 'rw', isa => 'TaskPipe::PathSettings', default => sub{
17 301 ▶ TaskPipe::PathSettings->new;
Subroutine __ANON__: called CC=1 SCAR=0.0
18 37 });
19 37 has filename => (is => 'rw', isa => 'Str');
20 37 has content => (is => 'rw', isa => 'HashRef|ArrayRef');
21 37 has mode => (is => 'rw', isa => 'PlanMode', default => 'tree');
22 has sm => (is => 'rw', isa => 'TaskPipe::SchemaManager', default => sub{
23 301 ▶ my $sm = TaskPipe::SchemaManager->new( scope => 'project' );
Subroutine __ANON__: called CC=1 SCAR=0.0
24 301 $sm->connect_schema;
25 301 return $sm;
26 37 });
27 has gm => (is => 'rw', isa => 'TaskPipe::SchemaManager', default => sub{
28 301 ▶ my $gm = TaskPipe::SchemaManager->new( scope => 'global' );
Subroutine __ANON__: called CC=1 SCAR=0.0
29 301 $gm->connect_schema;
30 301 return $gm;
31 37 });
32 has task => (is => 'rw', isa => 'TaskPipe::Task', lazy => 1, default => sub{
33 301 ▶ TaskPipe::Task->new(
Subroutine __ANON__: called CC=1 SCAR=0.0
34 sm => $_[0]->sm,
35 gm => $_[0]->gm
36 );
37 37 });
38  
39  
40 sub run{
41 0 ▶ my $self = shift;
Subroutine run: not called CC=1 SCAR=6.9
Pod undocumented
42  
43 0 $self->load_content;
44 0 $self->task->plan( $self->content );
45 0 $self->task->execute;
46  
47 }
48  
49  
50 sub load_content{
51 9 ▶ my $self = shift;
Subroutine load_content: called CC=2 SCAR=7.1
Pod undocumented
52  
53 9 my $logger = Log::Log4perl->get_logger;
54  
55 9 ▶ my $filename = $self->filename || $self->path_settings->project->plan;
Condition33%1/3
$self->filename || $self->path_settings->project->plan
l!l&&r!l&&!r
090
MC/DC0%0/2
$self->filename || $self->path_settings->project->plan
$self->filename $self->path_settings->project->plan
Truth table33%1/3
A || B
A= $self->filenameB= $self->path_settings->project->plan
ABresult
1X1
011
000
56  
57 9 my $path = $self->path_settings->path('plan',$filename);
58 9 $logger->debug("Path to plan file: $path");
59  
60 9 $self->content( $self->cascade_util->parser->( $path ) );
61 }
62  
63 =head1 NAME
64  
65 TaskPipe::Plan - manage plan files for TaskPipe
66  
67 =head1 DESCRIPTION
68  
69 It is not recommended to use this module directly. See the general manpages for TaskPipe
70  
71 =head1 AUTHOR
72  
73 Tom Gracey <tomgracey@gmail.com>
74  
75 =head1 COPYRIGHT AND LICENSE
76  
77 Copyright (c) Tom Gracey 2018
78  
79 TaskPipe is free software, licensed under
80  
81 The GNU Public License Version 3
82  
83 =cut
84  
85 37 __PACKAGE__->meta->make_immutable;
86 37 1;
« TaskPipe/Tool/Command_StopJob.pm ↑ Summary TaskPipe/PathSettings/Global.pm »