File Coverage

blib/lib/BioX/Workflow/Command/new.pm
Criterion Covered Total %
statement 20 26 76.9
branch n/a
condition n/a
subroutine 7 8 87.5
pod n/a
total 27 34 79.4


line stmt bran cond sub pod time code
1             package BioX::Workflow::Command::new;
2              
3 1     1   2262 use v5.10;
  1         4  
4 1     1   5 use MooseX::App::Command;
  1         29  
  1         11  
5              
6 1     1   11118 use Storable qw(dclone);
  1         3  
  1         59  
7 1     1   344 use YAML;
  1         5429  
  1         58  
8              
9 1     1   8 use MooseX::Types::Path::Tiny qw/Path/;
  1         2  
  1         48  
10              
11 1     1   2556 use BioSAILs::Utils::Traits qw(ArrayRefOfStrs);
  1         4  
  1         11  
12              
13             extends 'BioX::Workflow::Command';
14              
15             with 'BioX::Workflow::Command::Utils::Create';
16             with 'BioX::Workflow::Command::Utils::Files';
17              
18             command_short_description 'Create a new workflow';
19             command_long_description 'Create a new workflow';
20              
21             =head1 BioX::Workflow::Command::new
22              
23             Create a new workflow
24              
25             biox new -h
26             biox new -w my_new_workflow.yml
27              
28             =cut
29              
30             =head2 Command Line Options
31              
32             =cut
33              
34             option '+workflow' => (
35             isa => Path,
36             );
37              
38             option '+outfile' => (
39             default => sub {
40             my $self = shift;
41             my $workflow = $self->workflow;
42             return "$workflow";
43             },
44             );
45              
46             sub execute {
47 0     0     my $self = shift;
48              
49 0           my $global = {
50             global =>
51             [
52             { sample_rule => "(Sample_.*)" },
53             { indir => 'data/raw' },
54             { outdir => 'data/processed' },
55             { root_dir => 'data' },
56             { find_sample_bydir => 1 },
57             { by_sample_outdir => 1 },
58             ]
59             };
60              
61 0           my $rules = $self->add_rules;
62 0           $global->{rules} = $rules;
63              
64 0           $self->fh->print(Dump($global));
65 0           $self->fh->close;
66             }
67              
68 1     1   1102 no Moose;
  1         2  
  1         10  
69             __PACKAGE__->meta->make_immutable;
70              
71             1;