From 446e93378bf33c01c925da3a7f7241620b59db5a Mon Sep 17 00:00:00 2001 From: Takashi Kitajima Date: Tue, 6 Jun 2017 14:38:15 +0900 Subject: [PATCH] Fix #43 --- app/bin/theme-unit-test-ja.sh | 36 ++++++++++++++++++++++------------- app/bin/theme-unit-test.sh | 36 ++++++++++++++++++++++------------- 2 files changed, 46 insertions(+), 26 deletions(-) diff --git a/app/bin/theme-unit-test-ja.sh b/app/bin/theme-unit-test-ja.sh index 54770111..b04fb393 100644 --- a/app/bin/theme-unit-test-ja.sh +++ b/app/bin/theme-unit-test-ja.sh @@ -13,17 +13,27 @@ datetime=`date +%Y%m%d%H%M%S` wp db export "$themedir/../../dump-$datetime.sql" if [ -e "$themedir/../../dump-$datetime.sql" ]; then - wp plugin install --activate wordpress-importer - wp plugin is-installed wordpress-importer - - if [ $? -eq 0 ]; then - wp menu delete $(wp menu list --fields=term_id) --quiet - wp post delete $(wp post list --post_type=page,post --posts_per_page=-1 --format=ids) --force --quiet - - wget https://raw.githubusercontent.com/jawordpressorg/theme-test-data-ja/master/wordpress-theme-test-date-ja.xml -P $themedir - wp import "$themedir/wordpress-theme-test-date-ja.xml" --authors=create --quiet - wp menu location assign "All Pages" global-nav - wp menu location assign "All Pages" drawer-nav - rm -rf "$themedir/wordpress-theme-test-date-ja.xml" - fi + wp plugin is-installed wordpress-importer + + if [ $? -ne 0 ]; then + wp plugin install --activate wordpress-importer + fi + + if [ $? -eq 0 ]; then + wp menu list --format=ids + if [ $? -ne 0 ]; then + wp menu delete $? + fi + + wp post list --post_type=page,post --posts_per_page=-1 --format=ids + if [ $? -ne 0 ]; then + wp post delete $? + fi + + wget https://raw.githubusercontent.com/jawordpressorg/theme-test-data-ja/master/wordpress-theme-test-date-ja.xml -P $themedir + wp import "$themedir/wordpress-theme-test-date-ja.xml" --authors=create --quiet + wp menu location assign "All Pages" global-nav + wp menu location assign "All Pages" drawer-nav + rm -rf "$themedir/wordpress-theme-test-date-ja.xml" + fi fi diff --git a/app/bin/theme-unit-test.sh b/app/bin/theme-unit-test.sh index 527649f5..9d441935 100644 --- a/app/bin/theme-unit-test.sh +++ b/app/bin/theme-unit-test.sh @@ -13,17 +13,27 @@ datetime=`date +%Y%m%d%H%M%S` wp db export "$themedir/../../dump-$datetime.sql" if [ -e "$themedir/../../dump-$datetime.sql" ]; then - wp plugin install --activate wordpress-importer - wp plugin is-installed wordpress-importer - - if [ $? -eq 0 ]; then - wp menu delete $(wp menu list --fields=term_id) --quiet - wp post delete $(wp post list --post_type=page,post --posts_per_page=-1 --format=ids) --force --quiet - - wget https://wpcom-themes.svn.automattic.com/demo/theme-unit-test-data.xml -P $themedir - wp import "$themedir/theme-unit-test-data.xml" --authors=create --quiet - wp menu location assign "All Pages" global-nav - wp menu location assign "All Pages" drawer-nav - rm -rf "$themedir/theme-unit-test-data.xml" - fi + wp plugin is-installed wordpress-importer + + if [ $? -ne 0 ]; then + wp plugin install --activate wordpress-importer + fi + + if [ $? -eq 0 ]; then + wp menu list --format=ids + if [ $? -ne 0 ]; then + wp menu delete $? + fi + + wp post list --post_type=page,post --posts_per_page=-1 --format=ids + if [ $? -ne 0 ]; then + wp post delete $? + fi + + wget https://wpcom-themes.svn.automattic.com/demo/theme-unit-test-data.xml -P $themedir + wp import "$themedir/theme-unit-test-data.xml" --authors=create --quiet + wp menu location assign "All Pages" global-nav + wp menu location assign "All Pages" drawer-nav + rm -rf "$themedir/theme-unit-test-data.xml" + fi fi