From: tla Date: Wed, 20 Nov 2013 08:20:20 +0000 (+0100) Subject: make db/ directory for test DB if necessary X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bfaf51f3089dd3eff6c8ed8fbbc693e6f2079211;p=scpubgit%2Fstemmaweb.git make db/ directory for test DB if necessary --- diff --git a/script/maketestdb.pl b/script/maketestdb.pl index 389b8ec..a662274 100755 --- a/script/maketestdb.pl +++ b/script/maketestdb.pl @@ -9,7 +9,13 @@ use Text::Tradition::Directory; my $DBDIR = 'db'; my $DBNAME = 'traditions.db'; my $DBEXT = 'test'; -# Delete the old directory if it exists +# Make the directory on the filesystem if necessary +unless( -d $DBDIR ) { + mkdir $DBDIR + or die "Could not make database director $DBDIR"; + say "Created directory for test database"; +} +# Delete the old db if it exists if( -f "$DBDIR/$DBNAME.$DBEXT" ) { unlink( "$DBDIR/$DBNAME.$DBEXT" ); } @@ -28,7 +34,7 @@ my $dir = Text::Tradition::Directory->new( extra_args => { create => 1 } ); my $scope = $dir->new_scope(); -say "Created test directory"; +say "Created test database"; # Create users my $user = $dir->add_user({ username => 'user@example.org', password => 'UserPass' });