-
Notifications
You must be signed in to change notification settings - Fork 47
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
Add the Command changes for #120 #156
base: main
Are you sure you want to change the base?
Conversation
* Saves the command vars. | ||
* @var array | ||
*/ | ||
protected $commandVars = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need that class property? Why not doing everything into the execute() method?
For info, from the execute method, you can do
Context::getParam('current-version')
Context::getParam('new-version')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running Context::getParam('current-version')
in the execute()
method would break since it's not yet defined for instance when ran in the prerequisites.
Running Context::get('version-persister')->getCurrentVersion()
do the trick but if ran let's say in the prepareCommand()
, that will end up being the new released version and not the current one.
The only way found at this point to get the current version is to get it in the constructor but I might be missing something
} | ||
|
||
$this->commandVars['new_version'] = Context::getParam('new-version'); | ||
extract($this->commandVars); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know that extract() function. This is no magique. So ugly. So... :puke:
Can we do something more explicit? Like
foreach(['version', 'new_version'] as $possiblePlaceholder) {
...
}
exec('./RMT release -n --no-ansi --comment="test"', $output); | ||
$output = implode("\n", $output); | ||
$this->assertContains('Command Action : echo 1 2', $output); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, for the tests, thanks!
Work taken from #127
Updated the syntax to
%version%
and%new_version%