ensure git pushed function - code props to @fgarcia - #410
Conversation
| end | ||
|
|
||
| def ensure_git_pushed!(opts = {}) | ||
| branch = opts[:branch] || fetch(:branch) |
There was a problem hiding this comment.
fetch methoda has a second, default argument. so you can write fetch(:branch, opts[:branch])
There was a problem hiding this comment.
Interesting. I was actually thinking of it the other way around - if you write ensure_git_pushed! it will do what you expect, and if you have special needs you can specify opts[:branch] or opts[:remote] to override the defaults. Does that sound right?
|
This is an often requested feature, but i am not sure if I want to enforce it upon users. Will test it locally and see if it slows down the deploy significantly. If yes, then maybe just add the command as a comment in data/deploy.rb, if no then happily adding it. |
|
Yeah, I agree. It shouldn't be the default. I'll change ensure_git_pushed! to a comment in a few hours |
5f8cdb8 to
84bcfc2
Compare
|
I rebased and changed ensure git pushed to be in a comment. What else can I do to make it better? I'm happy to change whatever |
|
I moved this to a git task as it is using 'git'. Thank you for the idea! |
Fixes #295 by stealing the code
I don't think this code is ideal as-is. In particular, I'm not 100% sure where the helper should live, and I don't know if it should be included in the default deploy script.
Also, if there is a way to move it from the main deploy task to a before hook, that would be ideal, but I haven't gotten mina 1.x working yet myself so I'm not sure how before hooks work.