Skip to content

Commit

Permalink
Fixes #1443: blt setup:update:features-override-check is dependent on…
Browse files Browse the repository at this point in the history
… console window size. (#1454)

* Fixes #1443: blt setup:update:features-override-check is dependent on console window size.

* Using correct drush alias.
  • Loading branch information
grasmash authored May 1, 2017
1 parent 10a9bc3 commit 490536f
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions src/Robo/Commands/Setup/ConfigCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public function import() {
$task->exec("drush @$drush_alias cache-rebuild");
$task->run();

$this->checkFeaturesOverrides();

// Check for configuration overrides.
if (!$this->getConfigValue('cm.allow-overrides')) {
$this->say("Checking for config overrides...");
Expand Down Expand Up @@ -131,15 +133,30 @@ protected function importFeatures($task, $drush_alias, $cm_core_key) {
$task->exec("drush @$drush_alias features-revert-all --bundle=$bundle --yes");
}
}
}

/**
* Checks whether features are overridden.
*
* @throws \Exception
* If cm.features.no-overrides is true, and there are features overrides
* an exception will be thrown.
*/
protected function checkFeaturesOverrides() {
if ($this->getConfigValue('cm.features.no-overrides')) {
$this->say("Checking for features overrides...");
if ($this->getConfig()->has('cm.features.bundle')) {
$task = $this->taskExec()
->dir($this->getConfigValue('docroot'));
$drush_alias = $this->getConfigValue('drush.alias');
foreach ($this->getConfigValue('cm.features.bundle') as $bundle) {
$features_overriden = $task->exec("drush fl --bundle=${bundle} | grep -Ei '(changed|conflicts|added)( *)$");
// @todo emit:
// A feature in the ${bundle} bundle is overridden. You must
// re-export this feature to incorporate the changes.
// @todo throw Exception.
$task->exec("drush @$drush_alias fl --bundle=$bundle --format=json");
$result = $task->printOutput(TRUE)->run();
$output = $result->getOutputData();
$features_overriden = preg_match('/(changed|conflicts|added)( *)$/', $output);
if ($features_overriden) {
throw new \Exception("A feature in the $bundle bundle is overridden. You must re-export this feature to incorporate the changes.");
}
}
}
}
Expand Down

0 comments on commit 490536f

Please sign in to comment.