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

ensure git pushed function - code props to @fgarcia #410

Merged
merged 1 commit into from
Aug 28, 2016

Conversation

devvmh
Copy link
Contributor

@devvmh devvmh commented Aug 8, 2016

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.

@@ -15,6 +15,15 @@ def invoke(task, *args)
Rake::Task[task].reenable
end

def ensure_git_pushed!(opts = {})
branch = opts[:branch] || fetch(:branch)
Copy link
Member

Choose a reason for hiding this comment

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

fetch methoda has a second, default argument. so you can write fetch(:branch, opts[:branch])

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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?

@d4be4st
Copy link
Member

d4be4st commented Aug 9, 2016

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.

@devvmh
Copy link
Contributor Author

devvmh commented Aug 10, 2016

Yeah, I agree. It shouldn't be the default. I'll change ensure_git_pushed! to a comment in a few hours

@devvmh devvmh force-pushed the feature/ensure-git-pushed branch from 5f8cdb8 to 84bcfc2 Compare August 10, 2016 02:49
@devvmh
Copy link
Contributor Author

devvmh commented Aug 10, 2016

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

@d4be4st d4be4st merged commit 84bcfc2 into mina-deploy:master Aug 28, 2016
@d4be4st
Copy link
Member

d4be4st commented Aug 28, 2016

I moved this to a git task as it is using 'git'.

Thank you for the idea!

@devvmh devvmh deleted the feature/ensure-git-pushed branch September 19, 2016 02:33
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