« lib/BioX/Workflow/Command/run/Rules/Directives/Types/Glob.pm
↑ Summary
lib/BioX/Workflow/Command/Utils/Create.pm »
| 1 | package BioX::Workflow::Command::add; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use v5.10; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use MooseX::App::Command; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | use YAML; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 1 | extends 'BioX::Workflow::Command'; | |||||||||
| 11 | |||||||||||
| 12 | 1 | with 'BioX::Workflow::Command::Utils::Create'; | |||||||||
| 13 | 1 | with 'BioX::Workflow::Command::Utils::Files'; | |||||||||
| 14 | 1 | with 'BioX::Workflow::Command::Utils::Log'; | |||||||||
| 15 | |||||||||||
| 16 | 1 | command_short_description 'Add rules to an existing workflow.'; | |||||||||
| 17 | 1 | command_long_description 'Add rules to an existing workflow.'; | |||||||||
| 18 | |||||||||||
| 19 | =head1 BioX::Workflow::Command::add | ||||||||||
| 20 | |||||||||||
| 21 | This is the main class of the `biox-workflow.pl add` command. | ||||||||||
| 22 | |||||||||||
| 23 | =cut | ||||||||||
| 24 | |||||||||||
| 25 | =head2 Command Line Options | ||||||||||
| 26 | |||||||||||
| 27 | =cut | ||||||||||
| 28 | |||||||||||
| 29 | option '+outfile' => ( | ||||||||||
| 30 | 0 | ▶ | default => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 31 | 0 | my $self = shift; | |||||||||
| 32 | 0 | my $workflow = $self->workflow; | |||||||||
| 33 | 0 | return "$workflow"; | |||||||||
| 34 | }, | ||||||||||
| 35 | 1 | documentation => 'Write your workflow to a file. The default will write it out to the same workflow.', | |||||||||
| 36 | ); | ||||||||||
| 37 | |||||||||||
| 38 | 0 | ▶ | sub execute { | ||||||||
|
Subroutine
execute: not called CC=2 SCAR=17.9
| |||||||||||
| 39 | 0 | my $self = shift; | |||||||||
| 40 | |||||||||||
| 41 | 0 | ▶ | if(! $self->load_yaml_workflow){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | 0 | $self->app_log->warn('Exiting now.'); | |||||||||
| 43 | 0 | return; | |||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | 0 | $self->app_log->info('Adding rules: '.join(', ', $self->all_rules)); | |||||||||
| 47 | 0 | my $rules = $self->add_rules; | |||||||||
| 48 | |||||||||||
| 49 | 0 | map { push(@{$self->workflow_data->{rules}}, $_ ) } @{$rules}; | |||||||||
| 50 | |||||||||||
| 51 | 0 | $self->fh->print(Dump($self->workflow_data)); | |||||||||
| 52 | 0 | $self->fh->close; | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 56 | |||||||||||
| 57 | 1 | 1; | |||||||||