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