diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-04-17 16:11:08 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-04-17 16:11:08 +0100 |
commit | 193811edee2c42dcdb8d2d5cb18ed6dfaa92f5e9 (patch) | |
tree | 4aa5b29bdb676aa9bf36ac5f61a55982849aaf04 | |
parent | f65ecc75c0899b027ad549d92dc28311c313b2d0 (diff) | |
parent | 8d12789207e2b34ecc729f084a2ba1a59f175cd4 (diff) |
Merge branch '2079-check-latest-deploy'
-rwxr-xr-x | setenv.pl | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -6,9 +6,20 @@ use warnings; my $root; BEGIN { - use File::Basename qw(dirname); - use File::Spec; - $root = dirname(File::Spec->rel2abs(__FILE__)); + use Cwd qw(abs_path); + use File::Basename qw(dirname basename); + $root = dirname(abs_path(__FILE__)); +} + +# Check there is not a later timestamped deploy, if running in such a system + +if ($root =~ /fixmystreet-\d\d\d\d-\d\d-\d\dT\d\d-\d\d-\d\d$/) { + my @deploys = sort map { basename $_ } glob("$root/../fixmystreet-*"); + if (basename($root) ne $deploys[-1] && !$ENV{OLD_DEPLOY_ACKNOWLEDGED}) { + require Term::ANSIColor; + print Term::ANSIColor::colored("NOT THE LATEST DEPLOY; ABORTING\n", 'red'); + exit 1; + } } # Set the environment for the FixMyStreet project @@ -68,7 +79,7 @@ else { my @modules = sort - grep { m/File::/ } + grep { m/Cwd|File::(?!Glob)/ } map { s{\.pm$}{}; s{/}{::}g; $_ } grep { m{\.pm$} } keys %INC; |