| 1 | package Marathon::Deployment; | ||||||||||
| 2 | |||||||||||
| 3 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||
| 4 | 0 | my ($class, $args, $parent) = @_; | |||||||||
| 5 | my $self = bless { | ||||||||||
| 6 | applications => {}, | ||||||||||
| 7 | id => $args->{id}, | ||||||||||
| 8 | parent => $parent, | ||||||||||
| 9 | steps => [], | ||||||||||
| 10 | version => $args->{version}, | ||||||||||
| 11 | 0 | }; | |||||||||
| 12 | 0 | foreach my $application ( @{$args->{affectedApplications}} ) { | |||||||||
| 13 | 0 | $self->applications->{$application} = $parent->get_app($application); | |||||||||
| 14 | } | ||||||||||
| 15 | 0 | foreach my $step ( @{$args->{steps}} ) { | |||||||||
| 16 | # documentation has an odd format, each step being wrapped inside an array. | ||||||||||
| 17 | # defensive: | ||||||||||
| 18 | 0 | ▶ | if ( ref $step eq 'HASH' ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | 0 | $step = [ $step ]; | |||||||||
| 20 | } | ||||||||||
| 21 | 0 | foreach ( @{$step} ) { | |||||||||
| 22 | 0 | push @{$self->{steps}}, Marathon::Deployment::Step->new($_->{action}, $self->{applications}->{$_->{application}}); | |||||||||
| 23 | } | ||||||||||
| 24 | } | ||||||||||
| 25 | 0 | return $self; | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | package Marathon::Deployment::Step; | ||||||||||
| 29 | |||||||||||
| 30 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||
| 31 | 0 | my ($class, $action, $application) = @_; | |||||||||
| 32 | 0 | my $self = bless { | |||||||||
| 33 | action => $action, | ||||||||||
| 34 | application => $application, | ||||||||||
| 35 | }; | ||||||||||
| 36 | 0 | return $self; | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 0 | ▶ | sub action { | ||||||||
|
Subroutine
action: not called CC=1 SCAR=6.9
| |||||||||||
| 40 | 0 | my $self = shift; | |||||||||
| 41 | 0 | return $self->{action}; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 0 | ▶ | sub app { | ||||||||
|
Subroutine
app: not called CC=1 SCAR=6.9
| |||||||||||
| 45 | 0 | my $self = shift; | |||||||||
| 46 | 0 | return $self->application; | |||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | 0 | ▶ | sub application { | ||||||||
|
Subroutine
application: not called CC=1 SCAR=6.9
| |||||||||||
| 50 | 0 | my $self = shift; | |||||||||
| 51 | 0 | return $self->{application}; | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | 4 | 1; | |||||||||