diff --git a/README.md b/README.md index 77e0fc91..f747d449 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,12 @@ Minizuku is a WordPress theme to develop the child theme. ## Required * PHP 5.6+ +* WP-CLI ## How to build 1. `$ npm install` 2. `$ npm run gulp build` +3. `$ composer install` ## Start up build-in server ``` @@ -28,7 +30,7 @@ $ bash app/bin/theme-unit-test.sh ## Generate files needed for running PHPUnit tests. ``` -$ bash app/bin/scoffold-tests.sh +$ bash app/bin/scaffold-tests.sh ``` ## Run PHPUnit tests diff --git a/app/bin/scaffold-tests.sh b/app/bin/scaffold-tests.sh new file mode 100644 index 00000000..9170b156 --- /dev/null +++ b/app/bin/scaffold-tests.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +themedir=$(wp theme path $(wp theme list --field=name --status=active) --dir) +phar extract -f $(which wp) "$themedir/app/bin/wp.phar">/dev/null 2>&1 +wpclidir="$themedir/app/bin/wp.phar$(which wp)" + +if [ ! -e "$themedir/app/bin" ]; then + mkdir -p "$themedir/app/bin" +fi + +cp -f "$wpclidir/templates/install-wp-tests.sh" "$themedir/app/bin/install-wp-tests.sh" + +cp -f "$wpclidir/templates/phpunit.xml.dist" "$themedir/phpunit.xml" + +if [ ! -e "$themedir/tests" ]; then + mkdir "$themedir/tests" +fi + +cp -f "$wpclidir/templates/bootstrap.mustache" "$themedir/tests/bootstrap.mustache" +sed -e "s/require dirname( dirname( __FILE__ ) ) \. '\/{{plugin_slug}}\.php';/register_theme_directory( dirname( __FILE__ ) . '\/\.\.\/\.\.\/' ); switch_theme('mimizuku');/g" "$themedir/tests/bootstrap.mustache">"$themedir/tests/bootstrap.php" +rm -f "$themedir/tests/bootstrap.mustache" + +cp -f "$wpclidir/templates/test-sample.mustache" "$themedir/tests/test-sample.php" + +rm -rf "$themedir/app/bin/wp.phar" +echo "done!" diff --git a/app/bin/scoffold-tests.sh b/app/bin/scoffold-tests.sh deleted file mode 100644 index 82daf38e..00000000 --- a/app/bin/scoffold-tests.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -dir=`dirname $0` -phar extract -f $(which wp) "$dir/wp.phar">/dev/null 2>&1 -wpdir="$dir/wp.phar$(which wp)" - -cp -f "$wpdir/templates/install-wp-tests.sh" "$dir/install-wp-tests.sh" - -cp -f "$wpdir/templates/phpunit.xml.dist" "$dir/../../phpunit.xml" - -if [ ! -e "$dir/../../tests" ]; then - mkdir "$dir/../../tests" -fi - -cp -f "$wpdir/templates/bootstrap.mustache" "$dir/../../tests/bootstrap.mustache" -sed -e "s/require dirname( dirname( __FILE__ ) ) \. '\/{{plugin_slug}}\.php';/register_theme_directory( dirname( __FILE__ ) . '\/\.\.\/\.\.\/' ); switch_theme('mimizuku');/g" "$dir/../../tests/bootstrap.mustache">"$dir/../../tests/bootstrap.php" -rm -f "$dir/../../tests/bootstrap.mustache" - -cp -f "$wpdir/templates/test-sample.mustache" "$dir/../../tests/test-sample.php" - -rm -rf "$dir/wp.phar" -echo "done!" diff --git a/app/bin/theme-unit-test-ja.sh b/app/bin/theme-unit-test-ja.sh index 51583354..fb3750f7 100644 --- a/app/bin/theme-unit-test-ja.sh +++ b/app/bin/theme-unit-test-ja.sh @@ -2,9 +2,9 @@ dir=`dirname $0` datetime=`date +%Y%m%d%H%M%S` -wp db export "$dir/dump-$datetime.sql" +wp db export "$dir/../../dump-$datetime.sql" -if [ -e "$dir/dump-$datetime.sql" ]; then +if [ -e "$dir/../../dump-$datetime.sql" ]; then wp plugin install --activate wordpress-importer wp plugin is-installed wordpress-importer diff --git a/app/bin/theme-unit-test.sh b/app/bin/theme-unit-test.sh index a3b8a64f..c86a2e01 100644 --- a/app/bin/theme-unit-test.sh +++ b/app/bin/theme-unit-test.sh @@ -2,9 +2,9 @@ dir=`dirname $0` datetime=`date +%Y%m%d%H%M%S` -wp db export "$dir/dump-$datetime.sql" +wp db export "$dir/../../dump-$datetime.sql" -if [ -e "$dir/dump-$datetime.sql" ]; then +if [ -e "$dir/../../dump-$datetime.sql" ]; then wp plugin install --activate wordpress-importer wp plugin is-installed wordpress-importer diff --git a/app/bin/wpphpunit.sh b/app/bin/wpphpunit.sh index 161c737d..c640a190 100644 --- a/app/bin/wpphpunit.sh +++ b/app/bin/wpphpunit.sh @@ -2,6 +2,8 @@ set -ex; +dir=`dirname $0` + echo 'DROP DATABASE IF EXISTS wordpress_test;' | mysql -u root if [ -e /tmp/wordpress ]; then @@ -12,5 +14,5 @@ if [ -e /tmp/wordpress-tests-lib ]; then rm -fr /tmp/wordpress-tests-lib fi -bash app/bin/install-wp-tests.sh wordpress_test root '' localhost latest; +bash "$dir/install-wp-tests.sh" wordpress_test root '' localhost latest; phpunit diff --git a/composer.lock b/composer.lock index 2a3ea61c..9320ad4e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "efd7cb2cb9a855f12f139876e51680d2", - "content-hash": "9b839601f7e3b6b9c1d7cf5a35fedcf3", + "hash": "98e2239d28f1343cecacdf0c7b0ded93", + "content-hash": "7000dd705b55c60de36f196f6c8f2e1f", "packages": [], "packages-dev": [ { @@ -193,16 +193,16 @@ }, { "name": "symfony/config", - "version": "v3.1.4", + "version": "v3.1.5", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "431d28df9c7bb6e77f8f6289d8670b044fabb9e8" + "reference": "949e7e846743a7f9e46dc50eb639d5fde1f53341" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/431d28df9c7bb6e77f8f6289d8670b044fabb9e8", - "reference": "431d28df9c7bb6e77f8f6289d8670b044fabb9e8", + "url": "https://api.github.com/repos/symfony/config/zipball/949e7e846743a7f9e46dc50eb639d5fde1f53341", + "reference": "949e7e846743a7f9e46dc50eb639d5fde1f53341", "shasum": "" }, "require": { @@ -242,20 +242,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2016-08-27 18:50:07" + "time": "2016-09-25 08:27:07" }, { "name": "symfony/dependency-injection", - "version": "v3.1.4", + "version": "v3.1.5", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "6e4f3316afdc9783d7b48a136db89bd791b55698" + "reference": "8fa4be9a36f41e49b0c3969678c41c81ed463816" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/6e4f3316afdc9783d7b48a136db89bd791b55698", - "reference": "6e4f3316afdc9783d7b48a136db89bd791b55698", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/8fa4be9a36f41e49b0c3969678c41c81ed463816", + "reference": "8fa4be9a36f41e49b0c3969678c41c81ed463816", "shasum": "" }, "require": { @@ -302,20 +302,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2016-08-23 13:39:15" + "time": "2016-09-24 15:56:48" }, { "name": "symfony/filesystem", - "version": "v3.1.4", + "version": "v3.1.5", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "bb29adceb552d202b6416ede373529338136e84f" + "reference": "682fd8fdb3135fdf05fc496a01579ccf6c85c0e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/bb29adceb552d202b6416ede373529338136e84f", - "reference": "bb29adceb552d202b6416ede373529338136e84f", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/682fd8fdb3135fdf05fc496a01579ccf6c85c0e5", + "reference": "682fd8fdb3135fdf05fc496a01579ccf6c85c0e5", "shasum": "" }, "require": { @@ -351,7 +351,7 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2016-07-20 05:44:26" + "time": "2016-09-14 00:18:46" }, { "name": "wp-coding-standards/wpcs", diff --git a/package.json b/package.json index f108850f..44fdb7a6 100644 --- a/package.json +++ b/package.json @@ -13,20 +13,20 @@ }, "dependencies": { "font-awesome": "^4.6.3", - "getbasis": "^1.0.5", + "getbasis": "^2.0.0", "getbasis-drawer": "^2.0.0", "getbasis-hamburger-btn": "^1.0.0", "getbasis-layout": "^2.0.0", "getbasis-menu": "^2.0.0" }, "devDependencies": { - "autoprefixer": "^6.4.1", - "babel-preset-es2015": "^6.14.0", + "autoprefixer": "^6.5.1", + "babel-preset-es2015": "^6.16.0", "babelify": "^7.3.0", - "browser-sync": "^2.16.0", + "browser-sync": "^2.17.3", "browserify": "^13.1.0", "browserify-shim": "^3.8.12", - "cssnano": "^3.7.5", + "cssnano": "^3.7.7", "gulp": "^3.9.1", "gulp-postcss": "^6.2.0", "gulp-rename": "^1.2.2",