-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Conversation
* List of tasks names. | ||
* List of tasks names with before and after hooks. | ||
* | ||
* @deprecated v5.0 |
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 offer deprecate this as useless.
src/Task/Task.php
Outdated
@@ -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.'); | |||
} |
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 mentioned that there is no check that $task is a string.
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.
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) |
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.
#1061 – not 934
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.
@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?
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 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).
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.
@Elfet then I need to predict Pull Request's number to specify it in changelog.md? That's weird, but okay.
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.
Kind of, or you can add more commit after pr creation. I think other contributors doing that way.
recipe/common.php
Outdated
@@ -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'); |
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.
Move this to task command, as many users doesn't based on common recipe.
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.
@Elfet Should I move only this option or all above?
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.
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.
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.
@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.
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.
Yes, i'm already started working on tasks args/options.
src/Task/Task.php
Outdated
@@ -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.'); | |||
} |
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.
When it should be an InvalidArgumentException.
src/Task/Task.php
Outdated
@@ -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.'); |
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.
Same here: InvalidArgumentException.
src/Task/ScriptManager.php
Outdated
}; | ||
|
||
$script = $collect($name); | ||
$taskHierarchy = $collect($name); |
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 are you rename this? 🙂
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.
@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.
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.
But call name is ScriptManager
. What way we define a new term inside deployer. I think it is cool)
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.
@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.
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.
Please return script) I don't like naming for everything manager-it, manager-that. All what we write some sort of managers.
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.
Updated. Hmm, it's already called manager
so I've just suggested to rename to another manager
:) Meanwhile, it's returned to previous state.
Updated version of #934.