Skip to content

Commit

Permalink
Override CommandArguments::option to default option separator. (#1461)
Browse files Browse the repository at this point in the history
  • Loading branch information
malikkotob authored and grasmash committed May 2, 2017
1 parent 1c13c60 commit 473d1bb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/Robo/Commands/Drupal/DrupalCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ function ($string) {
->drush("site-install")
->arg($this->getConfigValue('project.profile.name'))
->rawArg("install_configure_form.update_status_module='array(FALSE,FALSE)'")
->option('site-name', $this->getConfigValue('project.human_name'), '=')
->option('site-mail', $this->getConfigValue('drupal.account.mail'), '=')
->option('site-name', $this->getConfigValue('project.human_name'))
->option('site-mail', $this->getConfigValue('drupal.account.mail'))
->option('account-name', $username, '=')
->option('account-mail', $this->getConfigValue('drupal.account.mail'), '=')
->option('locale', $this->getConfigValue('drupal.locale'), '=')
->option('account-mail', $this->getConfigValue('drupal.account.mail'))
->option('locale', $this->getConfigValue('drupal.locale'))
->assume(TRUE)
->printOutput(TRUE);

Expand Down
8 changes: 4 additions & 4 deletions src/Robo/Commands/Setup/ConfigCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ protected function importFeatures($task, $cm_core_key) {
// Clear drush caches to register features drush commands.
$task->drush("cc")->arg('drush');
foreach ($this->getConfigValue('cm.features.bundle') as $bundle) {
$task->drush("features-revert-all")->option('bundle', $bundle, '=');
$task->drush("features-revert-all")->option('bundle', $bundle);
// Revert all features again!
// @see https://www.drupal.org/node/2851532
$task->drush("features-revert-all")->option('bundle', $bundle, '=');
$task->drush("features-revert-all")->option('bundle', $bundle);
}
}
}
Expand All @@ -151,8 +151,8 @@ protected function checkFeaturesOverrides() {
$task = $this->taskDrush()->stopOnFail();
foreach ($this->getConfigValue('cm.features.bundle') as $bundle) {
$task->drush("fl")
->option('bundle', $bundle, '=')
->option('format', 'json', '=');
->option('bundle', $bundle)
->option('format', 'json');
$result = $task->printOutput(TRUE)->run();
$output = $result->getOutputData();
$features_overridden = preg_match('/(changed|conflicts|added)( *)$/', $output);
Expand Down
15 changes: 12 additions & 3 deletions src/Robo/Tasks/DrushTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
* ```
*/
class DrushTask extends CommandStack {
use CommandArguments;
use CommandArguments {
option as traitOption;
}

/**
* Site alias to prepend to each command.
Expand Down Expand Up @@ -254,7 +256,7 @@ protected function setOptionsForLastCommand() {
*/
protected function setGlobalOptions() {
if (isset($this->uri) && !empty($this->uri)) {
$this->option('uri', $this->uri, '=');
$this->option('uri', $this->uri);
}

if (isset($this->assume) && is_bool($this->assume)) {
Expand All @@ -271,10 +273,17 @@ protected function setGlobalOptions() {
}

if ($this->include) {
$this->option('include', $this->include, '=');
$this->option('include', $this->include);
}
}

/**
* Overriding CommandArguments::option to default option separator to '='.
*/
public function option($option, $value = NULL, $separator = '=') {
$this->traitOption($option, $value, $separator);
}

/**
* Overriding parent::run() method to remove printTaskInfo() calls.
*/
Expand Down

0 comments on commit 473d1bb

Please sign in to comment.