Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1669: Remove ExampleCommand and ExampleHook from template, require blt examples:init or something. #1697

Merged
merged 4 commits into from
Jun 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions scripts/blt/ci/internal/create_blt_project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions scripts/blt/ci/internal/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
File renamed without changes.
Empty file.
41 changes: 41 additions & 0 deletions src/Robo/Commands/Blt/ExamplesCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace Acquia\Blt\Robo\Commands\Blt;

use Acquia\Blt\Robo\BltTasks;
use Acquia\Blt\Robo\Exceptions\BltException;
use Robo\Contract\VerbosityThresholdInterface;

/**
* Defines commands in the "examples:*" namespace.
*/
class ExamplesCommand extends BltTasks {

/**
* Generates example files for writing custom commands and hooks.
*
* @command examples:init
*/
public function init() {
$result = $this->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("<info>Example commands and hooks were copied to your repository root.</info>");
}

}