use a default filename for configuration files

This commit is contained in:
Ray Elliott 2020-05-06 14:33:31 +01:00
parent c100b235fc
commit d8dbbfc462
9 changed files with 37 additions and 36 deletions

View File

@ -4,9 +4,6 @@ TODO
## TODO ## TODO
* `create-config.sh` - save as a default filename if no argument specified.
* if no file passed as argument try and load config file with the default
filename if it's present.
* Script to export database from production database * Script to export database from production database
* Script to export wordpress directory from production * Script to export wordpress directory from production
* Script to set up local container using exported database/wordpress installation * Script to set up local container using exported database/wordpress installation

View File

@ -1,11 +1,6 @@
#!/bin/sh #!/bin/sh
if [ -z "$1" ] ; then . ./load-config.sh
echo "Error - must supply config file"
exit 1
fi
. "$1"
./dev/container-create.sh ./dev/container-create.sh

View File

@ -1,10 +1,11 @@
#!/bin/sh #!/bin/sh
if [ -z "$1" ] ; then _file="$1"
echo "Error - must supply filename"
exit 1 if [ -z "$_file" ] ; then
_file="wp-dev-config"
fi fi
cp /home/ray/Projects/wordpress-dev/config-example "$1" cp /home/ray/Projects/wordpress-dev/wp-dev-config "$(pwd)/$_file"

15
import-testdata.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
. ./load-config.sh
_username="$_user_www"
_url="$_local_hostname.$_local_domain"
_path='/var/www/html/wordpress'
ssh "$_username@$_url" wget -O testdata.xml 'https://raw.githubusercontent.com/WPTRT/theme-unit-test/master/themeunittestdata.wordpress.xml'
ssh "$_username@$_url" wp "--path=$_path" \
import testdata.xml \
--authors=create
ssh "$_username@$_url" rm testdata.xml

View File

@ -1,11 +0,0 @@
#!/bin/sh
. ./env.sh
ssh "$remote_username@$remote_url" wget -O testdata.xml 'https://raw.githubusercontent.com/WPTRT/theme-unit-test/master/themeunittestdata.wordpress.xml'
ssh "$remote_username@$remote_url" wp "--path=$remote_path" \
import testdata.xml \
--authors=create
ssh "$remote_username@$remote_url" rm testdata.xml

14
load-config.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
_file="$1"
if [ -z "$_file" ] ; then
if [ -f "$(pwd)/wp-dev-config" ] ; then
_file="wp-dev-config"
else
echo "Must supply configuration file as an argument."
exit 1
fi
fi
. "$(pwd)/$_file"

View File

@ -1,11 +1,6 @@
#!/bin/sh #!/bin/sh
if [ -z "$1" ] ; then . ./load-config.sh
echo "Error - must supply config file"
exit 1
fi
. "$1"
./dev/export-data.sh ./dev/export-data.sh

View File

@ -1,11 +1,6 @@
#!/bin/sh #!/bin/sh
if [ -z "$1" ] ; then . ./load-config.sh
echo "Error - must supply config file"
exit 1
fi
. "$1"
_ssh_url="root@$_remote_host.$_domain" _ssh_url="root@$_remote_host.$_domain"