Skip to content

Commit

Permalink
Fixes acquia#1443: blt setup:update:features-override-check is depend…
Browse files Browse the repository at this point in the history
…ent on console window size.
  • Loading branch information
grasmash committed Apr 30, 2017
1 parent 8e05740 commit 53fa7c9
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 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,29 @@ 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'));
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 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 53fa7c9

Please sign in to comment.