Skip to content

Commit

Permalink
Fixup deployment comand
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Feb 17, 2024
1 parent e128795 commit f34cc58
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
49 changes: 49 additions & 0 deletions blt/src/Blt/Plugin/Commands/HsCommandTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace Humsci\Blt\Plugin\Commands;

/**
* Trait HsCommandTrait.
*
* @package Humsci\Blt\Plugin\Commands
*/
trait HsCommandTrait {

/**
* Ask a question to the user.
*
* @param string $question
* The question to ask.
* @param string $default
* Default value.
* @param bool $required
* If a response is required.
*
* @return string
* Response to the question.
*/
protected function askQuestion($question, $default = '', $required = FALSE) {
if ($default) {
$response = $this->askDefault($question, $default);
}
else {
$response = $this->ask($question);
}
if ($required && !$response) {
return $this->askQuestion($question, $default, $required);
}
return $response;
}

/**
* Return BLT.
*
* @return \Robo\Task\Base\Exec
* A drush exec command.
*/
protected function blt() {
return $this->taskExec($this->getConfigValue('repo.root') . '/vendor/bin/blt')
->option('no-interaction');
}

}
2 changes: 1 addition & 1 deletion blt/src/Blt/Plugin/Commands/HsCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
class HsCommands extends BltTasks {

use SwsCommandTrait;
use HsCommandTrait;

/**
* After code deployed, update all sites on the stack.
Expand Down

0 comments on commit f34cc58

Please sign in to comment.