From 92dc3e91eb42db519e3b5687bf7520665a1f2c4e Mon Sep 17 00:00:00 2001 From: Nigel Horne Date: Tue, 6 Feb 2024 13:08:33 -0500 Subject: [PATCH] Make the data directory, even on AUTOMATED TESTING environments --- Makefile.PL | 11 +++++++++++ bin/create_db.PL | 9 ++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index c46c34b..730e0c3 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -4,6 +4,17 @@ use strict; use warnings; use ExtUtils::MakeMaker 6.64; # 6.64 for TEST_REQUIRES +my @dirs = ( + 'lib/Genealogy/ObituaryDailyTimes/data' +); + +foreach my $dir(@dirs) { + if(! -d $dir) { + print "Creating the download directory $dir\n"; + mkdir $dir, 0755 || die "$dir: $@"; + } +} + my $prereqs = { 'autodie' => 0, 'Carp' => 0, diff --git a/bin/create_db.PL b/bin/create_db.PL index 5581c0a..8a23d86 100755 --- a/bin/create_db.PL +++ b/bin/create_db.PL @@ -44,17 +44,16 @@ my %normalised; my $force_flag; my $dir = 'lib/Genealogy/ObituaryDailyTimes/data'; -if(!-d $dir) { - # Make the data directory, even on AUTOMATED TESTING environments - mkdir $dir, 0755; -} - if(defined($ARGV[0]) && ($ARGV[0] eq '-f')) { $force_flag++; } elsif($ENV{'AUTOMATED_TESTING'}) { exit; } +if(!-d $dir) { + mkdir $dir, 0755; +} + my $filename = File::Spec->catdir($dir, 'obituaries.sql'); if(-r $filename) {