diff --git a/README.md b/README.md index ad8a387..505a872 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,6 @@ 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 wordpress directory from production * Script to set up local container using exported database/wordpress installation diff --git a/container-setup.sh b/container-setup.sh index 4806fde..25996d1 100755 --- a/container-setup.sh +++ b/container-setup.sh @@ -1,11 +1,6 @@ #!/bin/sh -if [ -z "$1" ] ; then - echo "Error - must supply config file" - exit 1 -fi - -. "$1" +. ./load-config.sh ./dev/container-create.sh diff --git a/create-config.sh b/create-config.sh index 3c2150d..834a7b1 100755 --- a/create-config.sh +++ b/create-config.sh @@ -1,10 +1,11 @@ #!/bin/sh -if [ -z "$1" ] ; then - echo "Error - must supply filename" - exit 1 +_file="$1" + +if [ -z "$_file" ] ; then + _file="wp-dev-config" fi -cp /home/ray/Projects/wordpress-dev/config-example "$1" +cp /home/ray/Projects/wordpress-dev/wp-dev-config "$(pwd)/$_file" diff --git a/import-testdata.sh b/import-testdata.sh new file mode 100755 index 0000000..33eea78 --- /dev/null +++ b/import-testdata.sh @@ -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 diff --git a/incorporate-this.sh b/incorporate-this.sh deleted file mode 100755 index 7636795..0000000 --- a/incorporate-this.sh +++ /dev/null @@ -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 diff --git a/load-config.sh b/load-config.sh new file mode 100755 index 0000000..a6fdbb1 --- /dev/null +++ b/load-config.sh @@ -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" diff --git a/publish.sh b/publish.sh index 27587e4..12e8523 100755 --- a/publish.sh +++ b/publish.sh @@ -1,11 +1,6 @@ #!/bin/sh -if [ -z "$1" ] ; then - echo "Error - must supply config file" - exit 1 -fi - -. "$1" +. ./load-config.sh ./dev/export-data.sh diff --git a/webserver-provision.sh b/webserver-provision.sh index 6986a3a..b731d2e 100755 --- a/webserver-provision.sh +++ b/webserver-provision.sh @@ -1,11 +1,6 @@ #!/bin/sh -if [ -z "$1" ] ; then - echo "Error - must supply config file" - exit 1 -fi - -. "$1" +. ./load-config.sh _ssh_url="root@$_remote_host.$_domain" diff --git a/config-example b/wp-dev-config similarity index 100% rename from config-example rename to wp-dev-config