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
'after' is not doing every time what is expected #1064
Comments
The current implementation of Whether or not this behaviour is generally correct is another question, but I think it does yield the expected results in the most common cases. |
@seenmyfate You'r right with your workaround. The only question for me was, if
With the given name I wouldn't expect the behavior. |
I've never seen a task be redefined with more behavior. Does this still behave the same way with newest Rake, and is this a common technique? I'd expect the output to be:
|
I believe it's typical, logic being that rake is Make in Ruby, make allows
subsequent definitions of "targets" (tasks, in Rake parlance) to extend
previous definitions in order that you say, setup the basic build commands
and then "#include" the dev / release make file extension to augment the
basics with environment specifics.
I might be a bit off the mark, but I'm just trying to recall this issue. I
believe historically "after" callbacks are only called once because of the
rake task being marked as "already done" (another relic from its build
tooling heritage) and this not firing.
On the train now so I can't quite make out if this bigger is relevant in
this case.
|
@will-in-wi it's still part of rake. It's a shortcut for With
you can write:
|
Well, I've learned something new about rake and capistrano. I agree the behavior as currently defined is unexpected. I'd be in favor of merging a PR which corrects this. I might have time to take a look, but if someone else wants to take a look, go for it! |
This test seems to be what is needed. It just needs to be made to pass. |
In my point of view this spec is correct. To get it pass can be difficult.
The first solution which comes into my mind is monkey patching But I don't know if changing the behavior of To me it doesn't matter any more. I'm out of ruby business for a year now. |
Just to play devil's advocate: is it worth making a breaking change to "correct" this behavior? To be clear, it probably won't break projects that use vanilla Capistrano and don't re-open tasks (a pretty esoteric feature of Rake, IMO). However I suspect a large portion of the Capistrano community assembles their deployment scripts by taking snippets from gists, Stack Overflow answers, and plugins, many which are not actively maintained. It is possible these could break in ways that are surprising and difficult to debug. If we wanted to be really cautious, we could do a deprecation/warning cycle, sort of like we did with Also consider this ticket was dormant since 2014. There doesn't seem to be a large number of people advocating for it. |
I'm totally okay with closing this as wontfix. I agree that it does not seem like many people are having issues with it, and it technically might break something. It does seem like it is unexpected behavior, however. So I'm not sure I have much of an opinion. Closing is less work than fixing, so I tend toward that unless there is a reason to fix. |
I think we came to the root of the issue thanks to @dspaeth-faber 's help. There's a trail of discussion, given that we all agree, I'm closing |
@mattbrictson I wouldn't call it an esoteric feature. When you use rake as a build tool, then you will like it. Further more when you use One more point I want to mention. The current implementation of The gem look's like this:
You try to override the task you need with a different behavior via:
Expected output:
Real output:
In this case you have to check every In my opinion I would deprecate |
Thanks for the additional example; that is a good illustration of what makes Capistrano vs Rake concepts confusing. If Capistrano were in a 0.x state, this would definitely be something I would consider changing. However given the maturity of the project and large number of existing users and plugins, we cannot change or deprecate the Also, IMHO, the |
after 'task1', 'my_task'
is not every time executed at the end of the task.For instance in a rake-file:
I don't know a solution at the moment. I think to get this issue fixed execute in rake application has to be extented, so that after tasks are executed at the end.
The text was updated successfully, but these errors were encountered: