You are here

public function RoboFile::checkOverridden in Panopoly 7

Checks if any of the features are overridden.

File

./RoboFile.php, line 226

Class

RoboFile
This is project's console commands configuration for Robo task runner.

Code

public function checkOverridden() {
  if (!$this
    ->isModuleEnabled([
    'features',
    'diff',
  ])) {
    throw new \Exception("The 'features' and 'diff' modules need to be enabled");
  }
  $overridden = FALSE;
  $first = TRUE;
  foreach ($this
    ->getPanopolyFeatures() as $panopoly_feature) {

    // We prime something or other by running the first feature and discarding
    // the result before running it again.
    if ($first) {
      $this
        ->runDrush("features-diff {$panopoly_feature}");
    }
    $this
      ->say("Checking <info>{$panopoly_feature}</info>...");
    $process = $this
      ->runDrush("features-diff {$panopoly_feature}");
    if ($process
      ->getExitCode() != 0 || strpos($process
      ->getErrorOutput(), "Feature is in its default state") === FALSE) {
      $this
        ->say("*** <error>OVERRIDDEN</error> ***");
      echo $process
        ->getOutput() . $process
        ->getErrorOutput();
      $overridden = TRUE;
    }
  }
  return $overridden ? 1 : 0;
}