Skip to content

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

Merged
d4be4st merged 1 commit into
mina-deploy:masterfrom
devvmh-forks:feature/ensure-git-pushed
Aug 28, 2016
Merged

ensure git pushed function - code props to @fgarcia#410
d4be4st merged 1 commit into
mina-deploy:masterfrom
devvmh-forks:feature/ensure-git-pushed

Conversation

@devvmh

@devvmh devvmh commented Aug 8, 2016

Copy link
Copy Markdown
Contributor

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.

Comment thread lib/mina/dsl.rb
end

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

Copy link
Copy Markdown
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
Copy Markdown
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

d4be4st commented Aug 9, 2016

Copy link
Copy Markdown
Member

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

devvmh commented Aug 10, 2016

Copy link
Copy Markdown
Contributor Author

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

devvmh commented Aug 10, 2016

Copy link
Copy Markdown
Contributor Author

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

d4be4st commented Aug 28, 2016

Copy link
Copy Markdown
Member

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