| 1 | package Dist::Conformance::Check::Workflows 0.006; | ||||||||||
| 2 | |||||||||||
| 3 | # ABSTRACT: The CI workflows exist | ||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use 5.040; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use warnings FATAL => 'all'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use re '/aasx'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use Mojo::Base 'Dist::Conformance::Check', -signatures; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | use Dist::Conformance::Schema(); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | |||||||||||
| 13 | 0 | ▶ | sub config_schema ($) { | ||||||||
|
Subroutine
config_schema: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 14 | return { | ||||||||||
| 15 | 0 | required => ['directory'], | |||||||||
| 16 | properties => { | ||||||||||
| 17 | directory => $Dist::Conformance::Schema::PATH, | ||||||||||
| 18 | required => { type => 'object', additionalProperties => { %$Dist::Conformance::Schema::PATH, nullable => 1 }, default => {} }, | ||||||||||
| 19 | }, | ||||||||||
| 20 | }; | ||||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | |||||||||||
| 24 | 0 | ▶ | sub missing_workflows ( $self, $snapshot ) { | ||||||||
|
Subroutine
missing_workflows: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 25 | 0 | my ( $directory, $required ) = @{ $self->config }{qw{directory required}}; | |||||||||
| 26 | 0 | my @missing = grep { !$snapshot->contains("$directory/$_") } sort keys %$required; | |||||||||
| 27 | 0 | return @missing; | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | |||||||||||
| 31 | 0 | ▶ | sub check ( $self, $snapshot ) { | ||||||||
|
Subroutine
check: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||
| 32 | 0 | my ( $directory, $required ) = @{ $self->config }{qw{directory required}}; | |||||||||
| 33 | 0 | ▶ | if ( !%$required ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | 0 | my @have = grep { index( $_, q{/} ) < 0 } $snapshot->under($directory); | |||||||||
| 35 | 0 | ▶ | return ( 'info', @have ? 'present: ' . join ', ', @have : 'none' ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | } | ||||||||||
| 37 | 0 | my @missing = $self->missing_workflows($snapshot); | |||||||||
| 38 | 0 | ▶ | return ( 'fail', 'missing: ' . join ', ', map { "$directory/$_" } @missing ) if @missing; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 0 | return ( 'pass', 'all present' ); | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | |||||||||||
| 43 | 0 | ▶ | sub update ( $self, $update ) { | ||||||||
|
Subroutine
update: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 44 | 0 | my ( $directory, $required ) = @{ $self->config }{qw{directory required}}; | |||||||||
| 45 | 0 | for my $name ( $self->missing_workflows( $update->snapshot ) ) { | |||||||||
| 46 | 0 | ▶ | if ( defined $required->{$name} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | 0 | $self->write_template( $update, "$directory/$name", $required->{$name} ); | |||||||||
| 48 | } | ||||||||||
| 49 | else { | ||||||||||
| 50 | 0 | $update->by_hand("Write $directory/$name by hand: the flavor names no template for it"); | |||||||||
| 51 | } | ||||||||||
| 52 | } | ||||||||||
| 53 | 0 | return; | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | __END__ | ||||||||||