From c638b6ac491bc8382e8fe9193b7e1fa88cd56531 Mon Sep 17 00:00:00 2001 From: defunctl Date: Tue, 19 May 2020 14:20:11 -0600 Subject: [PATCH 1/9] Removed "Defaults" from @option annotated commands causing a string to be sent in place of bool, change clean option to no-clean --- src/Commands/TestCommands.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Commands/TestCommands.php b/src/Commands/TestCommands.php index cc781440..923133aa 100644 --- a/src/Commands/TestCommands.php +++ b/src/Commands/TestCommands.php @@ -17,21 +17,22 @@ class TestCommands extends LocalDockerCommands { * * @command test * - * @option xdebug Run with Xdebug enabled. Default: false. - * @option clean Clean Codeception output directory and generated code. Default: true. - * @usage e.g. so test -- run integration + * @option $xdebug Run with Xdebug enabled + * @option $no-clean Do not run the codecept clean command first + * + * @usage e.g. so test --xdebug -- run integration * * @param array $args The Codeception command and arguments. * @param array $opts The options. */ - public function test( array $args, array $opts = [ 'xdebug' => false, 'clean' => true ] ): void { + public function test( array $args, array $opts = [ 'xdebug' => false, 'no-clean' => false ] ): void { $command = $this->prepareCommand( $args ); - if ( ! empty( $opts['clean'] ) ) { + if ( isset( $opts['no-clean'] ) && ! $opts['no-clean'] ) { $this->runCodecept( 'clean' ); } - if ( ! empty( $opts['xdebug'] ) ) { + if ( isset( $opts['xdebug'] ) && $opts['xdebug'] ) { $this->runCodeceptX( $command ); } else { $this->runCodecept( $command ); From a5a2e2b53446d9be0662921a5d1bfeda9cb905b5 Mon Sep 17 00:00:00 2001 From: defunctl Date: Tue, 19 May 2020 14:24:46 -0600 Subject: [PATCH 2/9] Clean up wp options, add support for -x for xdebug --- src/Commands/TestCommands.php | 2 +- src/Commands/WpCliCommands.php | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Commands/TestCommands.php b/src/Commands/TestCommands.php index 923133aa..f781877d 100644 --- a/src/Commands/TestCommands.php +++ b/src/Commands/TestCommands.php @@ -25,7 +25,7 @@ class TestCommands extends LocalDockerCommands { * @param array $args The Codeception command and arguments. * @param array $opts The options. */ - public function test( array $args, array $opts = [ 'xdebug' => false, 'no-clean' => false ] ): void { + public function test( array $args, array $opts = [ 'xdebug|x' => false, 'no-clean' => false ] ): void { $command = $this->prepareCommand( $args ); if ( isset( $opts['no-clean'] ) && ! $opts['no-clean'] ) { diff --git a/src/Commands/WpCliCommands.php b/src/Commands/WpCliCommands.php index dab6b915..ad61f530 100644 --- a/src/Commands/WpCliCommands.php +++ b/src/Commands/WpCliCommands.php @@ -17,16 +17,18 @@ class WpCliCommands extends LocalDockerCommands { * Run WP CLI commands in the SquareOne local container * * @command wp - * @option xdebug Run with Xdebug enabled. - * @option return Return the command's result, which requires no TTY - * @usage e.g. so wp -- option get home --format=json + * + * @option $xdebug Run with Xdebug enabled + * @option $return Return the command's result, which requires no TTY + * + * @usage e.g. so wp --xdebug -- option get home --format=json * * @param array $args The WP CLI command and arguments. * @param array $opts The options. * * @return \Robo\Result */ - public function wp( array $args, array $opts = [ 'xdebug' => false, 'return' => false ] ): Result { + public function wp( array $args, array $opts = [ 'xdebug|x' => false, 'return' => false ] ): Result { $command = $this->prepareCommand( $args ); $projectName = Robo::config()->get( LocalDocker::CONFIG_PROJECT_NAME ); @@ -36,7 +38,7 @@ public function wp( array $args, array $opts = [ 'xdebug' => false, 'return' => ->projectName( $projectName ) ->setContainer( 'php-fpm' ); - if ( ! empty( $opts['xdebug'] ) ) { + if ( isset( $opts['xdebug'] ) && true === $opts['xdebug'] ) { $task = $task->envVariable( 'PHP_IDE_CONFIG', "serverName=${projectName}.tribe" ) ->exec( sprintf( 'php -dxdebug.remote_autostart=1 -dxdebug.remote_host=host.tribe -dxdebug.remote_enable=1 /usr/local/bin/wp --allow-root %s', $command ) ); @@ -46,7 +48,7 @@ public function wp( array $args, array $opts = [ 'xdebug' => false, 'return' => } // Disable docker compose TTY / interactive so that Robo/Result::getMessage() is actually populated - if ( ! empty( $opts['return'] ) ) { + if ( isset( $opts['return'] ) && true === $opts['return'] ) { $task = $task->disablePseudoTty() ->interactive( false ); } From 308571971034bcdf53c31778a4c86d66562d44c9 Mon Sep 17 00:00:00 2001 From: defunctl Date: Tue, 19 May 2020 14:25:00 -0600 Subject: [PATCH 3/9] Update @option comment for start --- src/Commands/LocalDockerCommands.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Commands/LocalDockerCommands.php b/src/Commands/LocalDockerCommands.php index d76fb2e7..561042f8 100644 --- a/src/Commands/LocalDockerCommands.php +++ b/src/Commands/LocalDockerCommands.php @@ -51,7 +51,7 @@ public function getCertificate(): Certificate { * * @command start * - * @option browser|b Auto open the project in your default browser + * @option $browser|b Auto open the project in your default browser * * @param array $opts * From 027a4e3123cca1db634428ee49a68fd395091777 Mon Sep 17 00:00:00 2001 From: defunctl Date: Tue, 19 May 2020 14:41:46 -0600 Subject: [PATCH 4/9] Bump to 2.2.1-beta --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index a37af2c8..39de950a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.0-beta +2.2.1-beta From 0fc287fa4cffb0c7a55fd36243a604d959bf5faf Mon Sep 17 00:00:00 2001 From: defunctl Date: Tue, 19 May 2020 14:42:33 -0600 Subject: [PATCH 5/9] Bump example version, update example so wp command --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c8f1183c..61937bf1 100644 --- a/README.md +++ b/README.md @@ -26,10 +26,10 @@ Note for macOS users: This script will install brew and all of the requirements ### Usage - Run `so` to see a command list. -- To pass arguments to a command, separate the arguments with `--`, e.g. `so wp cli info -- --format=json` +- To pass arguments to a command, separate the arguments with `--`, e.g. `so wp -- cli info --format=json` ``` -SquareOne Global Docker 2.2.0-beta +SquareOne Global Docker 2.2.1-beta Usage: command [options] [arguments] From bfe992ee37f63a13c0d65e1abf3998c7928928a3 Mon Sep 17 00:00:00 2001 From: defunctl Date: Tue, 19 May 2020 14:45:19 -0600 Subject: [PATCH 6/9] Update autocompletion --- squareone.autocompletion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squareone.autocompletion b/squareone.autocompletion index 6495f2ce..68d9711f 100644 --- a/squareone.autocompletion +++ b/squareone.autocompletion @@ -66,7 +66,7 @@ _so() ;; test) - opts="${opts} --xdebug --clean" + opts="${opts} --xdebug --no-clean" ;; wp) From 4c079f10f1084c1be2a1fdf2b32fb743e7173990 Mon Sep 17 00:00:00 2001 From: defunctl Date: Tue, 19 May 2020 14:48:23 -0600 Subject: [PATCH 7/9] Remove strict comparision --- src/Commands/WpCliCommands.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Commands/WpCliCommands.php b/src/Commands/WpCliCommands.php index ad61f530..30ffafa5 100644 --- a/src/Commands/WpCliCommands.php +++ b/src/Commands/WpCliCommands.php @@ -38,7 +38,7 @@ public function wp( array $args, array $opts = [ 'xdebug|x' => false, 'return' = ->projectName( $projectName ) ->setContainer( 'php-fpm' ); - if ( isset( $opts['xdebug'] ) && true === $opts['xdebug'] ) { + if ( isset( $opts['xdebug'] ) && $opts['xdebug'] ) { $task = $task->envVariable( 'PHP_IDE_CONFIG', "serverName=${projectName}.tribe" ) ->exec( sprintf( 'php -dxdebug.remote_autostart=1 -dxdebug.remote_host=host.tribe -dxdebug.remote_enable=1 /usr/local/bin/wp --allow-root %s', $command ) ); @@ -48,7 +48,7 @@ public function wp( array $args, array $opts = [ 'xdebug|x' => false, 'return' = } // Disable docker compose TTY / interactive so that Robo/Result::getMessage() is actually populated - if ( isset( $opts['return'] ) && true === $opts['return'] ) { + if ( isset( $opts['return'] ) && $opts['return'] ) { $task = $task->disablePseudoTty() ->interactive( false ); } From 110c0c74105e7aef6f036ef65628e81db7def73a Mon Sep 17 00:00:00 2001 From: jfrydman Date: Tue, 19 May 2020 21:27:30 -0600 Subject: [PATCH 8/9] Use empty() checks in place of isset --- src/Commands/TestCommands.php | 8 ++++---- src/Commands/WpCliCommands.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Commands/TestCommands.php b/src/Commands/TestCommands.php index f781877d..b1cbb3dc 100644 --- a/src/Commands/TestCommands.php +++ b/src/Commands/TestCommands.php @@ -22,17 +22,17 @@ class TestCommands extends LocalDockerCommands { * * @usage e.g. so test --xdebug -- run integration * - * @param array $args The Codeception command and arguments. - * @param array $opts The options. + * @param array $args The Codeception command and arguments. + * @param array $opts The options. */ public function test( array $args, array $opts = [ 'xdebug|x' => false, 'no-clean' => false ] ): void { $command = $this->prepareCommand( $args ); - if ( isset( $opts['no-clean'] ) && ! $opts['no-clean'] ) { + if ( empty( $opts['no-clean'] ) ) { $this->runCodecept( 'clean' ); } - if ( isset( $opts['xdebug'] ) && $opts['xdebug'] ) { + if ( ! empty( $opts['xdebug'] ) ) { $this->runCodeceptX( $command ); } else { $this->runCodecept( $command ); diff --git a/src/Commands/WpCliCommands.php b/src/Commands/WpCliCommands.php index 30ffafa5..102d6b25 100644 --- a/src/Commands/WpCliCommands.php +++ b/src/Commands/WpCliCommands.php @@ -23,8 +23,8 @@ class WpCliCommands extends LocalDockerCommands { * * @usage e.g. so wp --xdebug -- option get home --format=json * - * @param array $args The WP CLI command and arguments. - * @param array $opts The options. + * @param array $args The WP CLI command and arguments. + * @param array $opts The options. * * @return \Robo\Result */ @@ -38,7 +38,7 @@ public function wp( array $args, array $opts = [ 'xdebug|x' => false, 'return' = ->projectName( $projectName ) ->setContainer( 'php-fpm' ); - if ( isset( $opts['xdebug'] ) && $opts['xdebug'] ) { + if ( ! empty( $opts['xdebug'] ) ) { $task = $task->envVariable( 'PHP_IDE_CONFIG', "serverName=${projectName}.tribe" ) ->exec( sprintf( 'php -dxdebug.remote_autostart=1 -dxdebug.remote_host=host.tribe -dxdebug.remote_enable=1 /usr/local/bin/wp --allow-root %s', $command ) ); @@ -48,7 +48,7 @@ public function wp( array $args, array $opts = [ 'xdebug|x' => false, 'return' = } // Disable docker compose TTY / interactive so that Robo/Result::getMessage() is actually populated - if ( isset( $opts['return'] ) && $opts['return'] ) { + if ( ! empty( $opts['return'] ) ) { $task = $task->disablePseudoTty() ->interactive( false ); } From fbcde44535e32f9d5105ce9d7ba9d01914c76b11 Mon Sep 17 00:00:00 2001 From: defunctl Date: Wed, 20 May 2020 09:14:59 -0600 Subject: [PATCH 9/9] Update order of build commands --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 61937bf1..34725121 100644 --- a/README.md +++ b/README.md @@ -103,9 +103,9 @@ Run `so config:copy-compose` to save the latest `docker-compose.yml` to `~/.con 1. Update the version in the [VERSION](./VERSION) file. 1. Run `composer run-script phar:install-tools` +1. Run `composer run-script autocomplete:build` 1. Run `composer dump-autoload -o --no-dev` 1. Run `composer run-script phar:build` -1. Run `composer run-script autocomplete:build` 1. Create a new release/tag on GitHub and attach the generated `so.phar` in the root directory in the binaries box. 1. Once the release is created you may want to bump the VERSION via semver with the `-dev` suffix.