Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correcting the vm command invocation. #2979

Merged
merged 2 commits into from
Aug 3, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/Robo/Commands/Setup/WizardCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ public function wizard($options = [
}

if ($answers['vm']) {
$this->invokeCommand('vm', ['--yes']);
$this->invokeCommand('vm', [
[
'no-boot' => '--yes',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never passed arguments to invokeCommand before, but it seems like you would want to do it like this, no?

$this->invokeCommand('vm', [
  [
    'no-boot',
    'yes',
  ],
]);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would end up with the vm method getting an array with two numerically indexed values, but it expects an associative array with one value where the key is 'no-boot'.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that makes sense as such. But if no-boot requires a value, wouldn't it be TRUE or something? Why --yes?

I get why you'd want no-boot and --yes as separate options, I guess I just don't understand how there's a key->value relationship between them.

Copy link
Contributor Author

@ba66e77 ba66e77 Jul 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/shrug I made the change that allowed minimal modification to make the thing work as expected. I can't speak to the initial rational for why it was written as it is.

But what we have is a method that expects a $options parameter and checks the value of the 'no-boot' key within that $options array

public function vm($options = ['no-boot' => FALSE]) {
    ...blah, blah, blah...
    if (!$options['no-boot'] && !$this->getInspector()->isDrupalVmBooted()) {
      return $this->boot();
    }
  }

I'm not averse to refactoring it to take inputs differently but it isn't currently so janky that it offends, so I'm inclined to put refactoring it in the 'someday' column and deal with bigger issues first.

],
]);
}
}

Expand Down