Skip to content

Commit

Permalink
Removes drush tasks and adds more sprintf calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
typhonius committed Mar 21, 2020
1 parent 75a7504 commit b1a9228
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/AcquiaCli.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class AcquiaCli

const NAME = 'AcquiaCli';

const VERSION = '1.0.4-dev';
const VERSION = '2.0.0-dev';

/**
* AcquiaCli constructor.
Expand Down
7 changes: 2 additions & 5 deletions src/Commands/AcquiaCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,11 @@ protected function copyFiles($uuid, EnvironmentResponse $environmentFrom, Enviro
* @param string $uuid
* @param EnvironmentResponse $environmentFrom
* @param EnvironmentResponse $environmentTo
* @param bool $skipDrush
*/
protected function acquiaDeployEnvToEnv(
$uuid,
EnvironmentResponse $environmentFrom,
EnvironmentResponse $environmentTo,
$skipDrush
EnvironmentResponse $environmentTo
) {
$this->backupAllEnvironmentDbs($uuid, $environmentTo);
$this->say(
Expand All @@ -392,9 +390,8 @@ protected function acquiaDeployEnvToEnv(
* @param string $uuid
* @param EnvironmentResponse $environment
* @param string $branch
* @param bool $skipDrushTasks
*/
protected function acquiaDeployEnv($uuid, EnvironmentResponse $environment, $branch, $skipDrushTasks)
protected function acquiaDeployEnv($uuid, EnvironmentResponse $environment, $branch)
{
$this->backupAllEnvironmentDbs($uuid, $environment);
$this->say(sprintf('Deploying %s to the %s environment', $branch, $environment->label));
Expand Down
24 changes: 6 additions & 18 deletions src/Commands/DeployCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,15 @@ class DeployCommand extends AcquiaCommand
*
* @param string $uuid
* @param string $branch
* @param bool $skipDrushTasks
* Skips Drush tasks to set maintenance mode, rebuild cache, update the database, and import config
* (not recommended unless you know what you are doing).
*
* @command prod:deploy
*/
public function acquiaDeployProd($uuid, $branch, $skipDrushTasks = false)
public function acquiaDeployProd($uuid, $branch)
{
$this->yell('WARNING: DEPLOYING TO PROD');
if ($this->confirm('Are you sure you want to deploy to prod?')) {
$environment = $this->getEnvironmentFromEnvironmentName($uuid, 'prod');
$skipDrushTasks = filter_var($skipDrushTasks, FILTER_VALIDATE_BOOLEAN);
$this->acquiaDeployEnv($uuid, $environment, $branch, $skipDrushTasks);
$this->acquiaDeployEnv($uuid, $environment, $branch);
}
}

Expand All @@ -37,21 +33,17 @@ public function acquiaDeployProd($uuid, $branch, $skipDrushTasks = false)
* @param string $uuid
* @param EnvironmentResponse $environment
* @param string $branch
* @param bool $skipDrushTasks
* Skips Drush tasks to set maintenance mode, rebuild cache, update the database, and import config
* (not recommended unless you know what you are doing).
* @throws \Exception
*
* @command preprod:deploy
*/
public function acquiaDeployPreProd($uuid, $environment, $branch, $skipDrushTasks = false)
public function acquiaDeployPreProd($uuid, $environment, $branch)
{
if ($environment->name == 'prod') {
throw new \Exception('Use the prod:deploy command for the production environment.');
}

$skipDrushTasks = filter_var($skipDrushTasks, FILTER_VALIDATE_BOOLEAN);
$this->acquiaDeployEnv($uuid, $environment, $branch, $skipDrushTasks);
$this->acquiaDeployEnv($uuid, $environment, $branch);
}

/**
Expand All @@ -60,21 +52,17 @@ public function acquiaDeployPreProd($uuid, $environment, $branch, $skipDrushTask
* @param string $uuid
* @param EnvironmentResponse $environmentFrom
* @param EnvironmentResponse $environmentTo
* @param bool $skipDrushTasks
* Skips Drush tasks to set maintenance mode, rebuild cache, update the database, and import config
* (not recommended unless you know what you are doing).
* @throws \Exception
*
* @command preprod:deployfromenv
*/
public function acquiaDeployPreProdFromEnv($uuid, $environmentFrom, $environmentTo, $skipDrushTasks = false)
public function acquiaDeployPreProdFromEnv($uuid, $environmentFrom, $environmentTo)
{
if ($environmentTo->name == 'prod') {
throw new \Exception('Use the prod:deployfromenv command for the production environment.');
}

$skipDrushTasks = filter_var($skipDrushTasks, FILTER_VALIDATE_BOOLEAN);
$this->acquiaDeployEnvToEnv($uuid, $environmentFrom, $environmentTo, $skipDrushTasks);
$this->acquiaDeployEnvToEnv($uuid, $environmentFrom, $environmentTo);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/Commands/SetupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ public function __construct()
public function setup()
{
foreach ($this->configFiles as $type => $location) {
$this->say("Checking ${type} configuration at ${location}");
$this->say(sprintf('Checking %s configuration at %s', $type, $location));
if (file_exists($location)) {
$this->yell("${type} configuration file found");
$this->yell(sprintf('%s configuration file found', $type));
if (!is_readable($location) && !@chmod($location, 0644)) {
$this->yell("${type} configuration is not readable", 40, 'red');
$this->yell(sprintf('%s configuration is not readable', $type), 40, 'red');
continue;
}
if ($this->confirm('Would you like to view the contents of this file?')) {
Expand All @@ -50,7 +50,7 @@ public function setup()
if ($this->confirm("Would you like to delete and regenerate the acquiacli.yml file at ${location}?")) {
$this->createConfigYaml($location);
}
} elseif ($this->confirm("No file found. Would you like to add a file at ${location}?")) {
} elseif ($this->confirm(sprintf('No file found. Would you like to add a file at %s?', $location))) {
$this->createConfigYaml($location);
}
}
Expand Down

0 comments on commit b1a9228

Please sign in to comment.