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

Add the Command changes for #120 #156

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Jonathanm10
Copy link
Contributor

Work taken from #127

Updated the syntax to %version% and %new_version%

* Saves the command vars.
* @var array
*/
protected $commandVars = [];
Copy link
Member

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')

Copy link
Contributor Author

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);
Copy link
Member

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);
}
Copy link
Member

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants