| 1 | #! /usr/bin/env perl | ||
| 2 | |||
| 3 | use File::Find; | ||
| 4 | use Cwd; | ||
| 5 | |||
| 6 | my $root = getcwd(); | ||
| 7 | |||
| 8 | if ($^O =~ 'MSWin'){ | ||
| 9 | find( { wanted => \&wanted, no_chdir => 1 } , 'examples/'); | ||
| 10 | } else { | ||
| 11 | my $cmd = "cd examples && strun --recurse --purge-cache --format production"; | ||
| 12 | (system($cmd) == 0) or die "$cmd failed"; | ||
| 13 | } | ||
| 14 | |||
| 15 | my %seen; | ||
| 16 | |||
| 17 | sub wanted { | ||
| 18 | |||
| 19 | return unless $File::Find::name=~/(story|hook)\.(pl|rb|bash|py|pm|ps1)$/ or /meta\.txt$/; | ||
| 20 | |||
| 21 | return unless -e $File::Find::dir."/windows.test"; | ||
| 22 | |||
| 23 | (my $dir = $File::Find::dir)=~s{examples/}{}; | ||
| 24 | |||
| 25 | return if $dir=~/modules/; | ||
| 26 | |||
| 27 | return if $seen{$dir}; | ||
| 28 | |||
| 29 | my $cmd = "cd examples && strun --purge-cache --story $dir --format production"; | ||
| 30 | |||
| 31 | (system($cmd) == 0) or die "$cmd failed"; | ||
| 32 | |||
| 33 | $seen{$dir}++; | ||
| 34 | |||
| 35 | } | ||
| 36 | |||
| 37 |