From 8f6ab59f1950475d8ac33abd328dbb27dde34452 Mon Sep 17 00:00:00 2001 From: Matthew Grasmick Date: Mon, 19 Jun 2017 16:16:45 -0400 Subject: [PATCH 1/4] Fixes #1669: Remove ExampleCommand and ExampleHook from template, require `blt examples:init` or something. --- scripts/blt/ci/internal/create_blt_project.sh | 3 ++ .../blt/examples}/Commands/ExampleCommand.php | 0 .../src => scripts/blt/examples}/Filesets.php | 1 - .../blt/examples}/Hooks/ExampleHook.php | 0 .../Commands/Blt/CreateProjectCommand.php | 0 src/Robo/Commands/Blt/ExamplesCommand.php | 42 +++++++++++++++++++ 6 files changed, 45 insertions(+), 1 deletion(-) rename {template/blt/src => scripts/blt/examples}/Commands/ExampleCommand.php (100%) rename {template/blt/src => scripts/blt/examples}/Filesets.php (99%) rename {template/blt/src => scripts/blt/examples}/Hooks/ExampleHook.php (100%) delete mode 100644 src/Robo/Commands/Blt/CreateProjectCommand.php create mode 100644 src/Robo/Commands/Blt/ExamplesCommand.php diff --git a/scripts/blt/ci/internal/create_blt_project.sh b/scripts/blt/ci/internal/create_blt_project.sh index 2ece82558..1d939de7b 100755 --- a/scripts/blt/ci/internal/create_blt_project.sh +++ b/scripts/blt/ci/internal/create_blt_project.sh @@ -49,4 +49,7 @@ blt setup:cloud-hooks sed -i "s:deploy_updates:deploy_install:g" hooks/common/post-code-deploy/post-code-deploy.sh sed -i "s:deploy_updates:deploy_install:g" hooks/common/post-code-update/post-code-update.sh +# Create example command and hook files. +blt examples:init + set +v diff --git a/template/blt/src/Commands/ExampleCommand.php b/scripts/blt/examples/Commands/ExampleCommand.php similarity index 100% rename from template/blt/src/Commands/ExampleCommand.php rename to scripts/blt/examples/Commands/ExampleCommand.php diff --git a/template/blt/src/Filesets.php b/scripts/blt/examples/Filesets.php similarity index 99% rename from template/blt/src/Filesets.php rename to scripts/blt/examples/Filesets.php index 92700cf21..a441adbf2 100644 --- a/template/blt/src/Filesets.php +++ b/scripts/blt/examples/Filesets.php @@ -1,7 +1,6 @@ taskFilesystemStack() + ->copy( + $this->getConfigValue('blt.root') . '/scripts/blt/examples/Commands/ExampleCommand.php', + $this->getConfigValue('repo.root') . '/blt/src/Commands/ExampleCommand.php', FALSE) + ->copy( + $this->getConfigValue('blt.root') . '/scripts/blt/examples/Hooks/ExampleHook.php', + $this->getConfigValue('repo.root') . '/blt/src/Hooks/ExampleHook.php', FALSE) + ->copy( + $this->getConfigValue('blt.root') . '/scripts/blt/examples/Filesets.php', + $this->getConfigValue('repo.root') . '/blt/src/Filesets.php', FALSE) + ->stopOnFail() + ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE) + ->run(); + + if (!$result->wasSuccessful()) { + throw new BltException("Could not copy example files into the repository root."); + } + + $this->say("Example commands and hooks were copied to your repository root."); + } + +} From 243f76b96d75b733a39f80d2dbdae027d4a41375 Mon Sep 17 00:00:00 2001 From: Matthew Grasmick Date: Mon, 19 Jun 2017 16:28:10 -0400 Subject: [PATCH 2/4] Adding space. --- scripts/blt/examples/Filesets.php | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/blt/examples/Filesets.php b/scripts/blt/examples/Filesets.php index a441adbf2..92700cf21 100644 --- a/scripts/blt/examples/Filesets.php +++ b/scripts/blt/examples/Filesets.php @@ -1,6 +1,7 @@ Date: Mon, 19 Jun 2017 16:30:27 -0400 Subject: [PATCH 3/4] PHPCS fix. --- src/Robo/Commands/Blt/ExamplesCommand.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Robo/Commands/Blt/ExamplesCommand.php b/src/Robo/Commands/Blt/ExamplesCommand.php index 43213731c..d32cee146 100644 --- a/src/Robo/Commands/Blt/ExamplesCommand.php +++ b/src/Robo/Commands/Blt/ExamplesCommand.php @@ -5,7 +5,6 @@ use Acquia\Blt\Robo\BltTasks; use Acquia\Blt\Robo\Exceptions\BltException; use Robo\Contract\VerbosityThresholdInterface; -use Symfony\Component\Yaml\Yaml; /** * Defines commands in the "examples:*" namespace. From 5c0c49cc5a68451b056ee1d3e34c36c98930e900 Mon Sep 17 00:00:00 2001 From: Matthew Grasmick Date: Mon, 19 Jun 2017 16:55:16 -0400 Subject: [PATCH 4/4] Test custom command execution. --- scripts/blt/ci/internal/run_tests.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/blt/ci/internal/run_tests.sh b/scripts/blt/ci/internal/run_tests.sh index 29cd15f2a..acbbb3362 100755 --- a/scripts/blt/ci/internal/run_tests.sh +++ b/scripts/blt/ci/internal/run_tests.sh @@ -39,6 +39,9 @@ blt deploy:update # Test SimpleSAMLphp configuration. blt simplesamlphp:init +# Test that custom commands are loaded. +blt custom:hello + # Run the doctor. blt doctor