| 1 | ## no critic (RequireUseStrict) | ||||||||||
| 2 | package Tapper::Producer::NewestPackage; | ||||||||||
| 3 | 1 | our $AUTHORITY = 'cpan:TAPPER'; | |||||||||
| 4 | # ABSTRACT: produce preconditions via find latest changed file | ||||||||||
| 5 | 1 | $Tapper::Producer::NewestPackage::VERSION = '5.0.1'; | |||||||||
| 6 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use YAML; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 1 | ▶ | use 5.010; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 1 | ▶ | use Tapper::Config; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 1 | ▶ | use File::stat; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | |||||||||||
| 15 | 0 | ▶ | sub younger { stat($a)->mtime() <=> stat($b)->mtime() } | ||||||||
|
Subroutine
younger: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 16 | |||||||||||
| 17 | |||||||||||
| 18 | 0 | ▶ | sub produce { | ||||||||
|
Subroutine
produce: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 19 | 0 | my ($self, $job, $produce) = @_; | |||||||||
| 20 | |||||||||||
| 21 | 0 | my $source_dir = $produce->{source_dir}; | |||||||||
| 22 | 0 | my @files = sort younger <$source_dir/*>; | |||||||||
| 23 | return { | ||||||||||
| 24 | 0 | ▶ | error => 'No files found in $source_dir', | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | } if not @files; | ||||||||||
| 26 | 0 | my $use_file = pop @files; | |||||||||
| 27 | |||||||||||
| 28 | 0 | my $nfs = Tapper::Config->subconfig->{paths}{prc_nfs_mountdir}; | |||||||||
| 29 | 0 | ▶ | die "$use_file not available to Installer" unless $use_file=~/^$nfs/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | |||||||||||
| 31 | 0 | my $retval = [{ | |||||||||
| 32 | precondition_type => 'package', | ||||||||||
| 33 | filename => $use_file, | ||||||||||
| 34 | },]; | ||||||||||
| 35 | return { | ||||||||||
| 36 | 0 | precondition_yaml => Dump(@$retval), | |||||||||
| 37 | }; | ||||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 1 | 1; | |||||||||
| 41 | |||||||||||
| 42 | __END__ | ||||||||||