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 --no-hooks option for running commands without before() and after() (#934) #1061

Merged
merged 4 commits into from
Mar 5, 2017

Conversation

pluseg
Copy link
Contributor

@pluseg pluseg commented Mar 3, 2017

Q A
Bug fix? No
New feature? Yes
BC breaks? No
Deprecations? Yes
Fixed tickets N/A

Updated version of #934.

@pluseg pluseg mentioned this pull request Mar 3, 2017
* List of tasks names.
* List of tasks names with before and after hooks.
*
* @deprecated v5.0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I offer deprecate this as useless.

@@ -227,6 +227,10 @@ public function setPrivate()
*/
public function addBefore($task)
{
if (!is_string($task)) {
throw new \RuntimeException('Invalid argument to `before` hook of "' . $this->getName() . '" task.');
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mentioned that there is no check that $task is a string.

Copy link
Member

Choose a reason for hiding this comment

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

When it should be an InvalidArgumentException.

CHANGELOG.md Outdated
@@ -6,6 +6,7 @@
### Added
- Add a way to retrieve a defined task [#1008](https://github.com/deployphp/deployer/pull/1008)
- Add support for configFile in the NativeSsh implementation [#979](https://github.com/deployphp/deployer/pull/979)
- Add `--no-hooks` option for running commands without `before()` and `after()` [#934](https://github.com/deployphp/deployer/pull/934)
Copy link
Member

Choose a reason for hiding this comment

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

#1061 – not 934

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Elfet I don't understand this rule. I think that the link must point to an issue or PR which describes the problem. Therefore I pointed out previous PR. Isn't it correct?

Copy link
Member

@antonmedv antonmedv Mar 3, 2017

Choose a reason for hiding this comment

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

I think it's better to send to actual pr with implementation. Issues if is there is commit to master, but maybe better to send to commit (or both).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Elfet then I need to predict Pull Request's number to specify it in changelog.md? That's weird, but okay.

Copy link
Member

Choose a reason for hiding this comment

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

Kind of, or you can add more commit after pr creation. I think other contributors doing that way.

@@ -119,6 +119,7 @@
option('tag', null, InputOption::VALUE_OPTIONAL, 'Tag to deploy');
option('revision', null, InputOption::VALUE_OPTIONAL, 'Revision to deploy');
option('branch', null, InputOption::VALUE_OPTIONAL, 'Branch to deploy');
option('no-hooks', null, InputOption::VALUE_NONE, 'Run task without after/before hooks');
Copy link
Member

Choose a reason for hiding this comment

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

Move this to task command, as many users doesn't based on common recipe.

Copy link
Contributor Author

@pluseg pluseg Mar 3, 2017

Choose a reason for hiding this comment

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

@Elfet Should I move only this option or all above?

Copy link
Member

Choose a reason for hiding this comment

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

Only this one. Other used by common recipe. So if your deploy.php does not require common.php, i may no need in tag/rev/branch options.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Elfet Okay, I'll move it to TaskCommand. Meanwhile I think that it's okay to move all options to TaskCommand because of they are optional. Moreover, this way of defining options doesn't allow to add new ConsoleCommand with different arguments. I've already tried to add SSHCommand and faced that. I was not able to add required argument as there were defined options before. I guess that you will face it in version 5 refactoring.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, i'm already started working on tasks args/options.

@@ -227,6 +227,10 @@ public function setPrivate()
*/
public function addBefore($task)
{
if (!is_string($task)) {
throw new \RuntimeException('Invalid argument to `before` hook of "' . $this->getName() . '" task.');
}
Copy link
Member

Choose a reason for hiding this comment

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

When it should be an InvalidArgumentException.

@@ -235,6 +239,10 @@ public function addBefore($task)
*/
public function addAfter($task)
{
if (!is_string($task)) {
throw new \RuntimeException('Invalid argument to `after` hook of "' . $this->getName() . '" task.');
Copy link
Member

Choose a reason for hiding this comment

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

Same here: InvalidArgumentException.

};

$script = $collect($name);
$taskHierarchy = $collect($name);
Copy link
Member

Choose a reason for hiding this comment

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

Why are you rename this? 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Elfet I refactored it as non obvious name. $script doesn't reflect the contents as for me and $taskHierarchy does. $collect returns exactly hierarchal collection of all related tasks. If you want I will return previous name or rename to something better.

Copy link
Member

Choose a reason for hiding this comment

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

But call name is ScriptManager. What way we define a new term inside deployer. I think it is cool)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Elfet Actually, I'd like to rename this class to TaskManager too :) It is responsible for managing tasks, not scripts. It isn't obvious for me as a newcomer. But of course it's up to you. If you want, I will return $script variable.

Copy link
Member

Choose a reason for hiding this comment

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

Please return script) I don't like naming for everything manager-it, manager-that. All what we write some sort of managers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. Hmm, it's already called manager so I've just suggested to rename to another manager :) Meanwhile, it's returned to previous state.

@antonmedv antonmedv merged commit ed4957a into deployphp:master Mar 5, 2017
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.

3 participants