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

✨ Add possibility to remove hook #53

Merged
merged 5 commits into from
Jun 17, 2017
Merged

✨ Add possibility to remove hook #53

merged 5 commits into from
Jun 17, 2017

Conversation

thibmaek
Copy link
Contributor

@thibmaek thibmaek commented Jun 15, 2017

Description

Introduces the new command --remove|-r to unlink a previously set hook. Avoids having to dive into the .git dir in a terminal and remove it there. I love Gitmoji, but sometimes needed to remove it for projects where other people didn't want to use it.

It uses fs#unlink which is an async method that takes the path and a completion callback. Very much like fs#writeFile.

Tests

  • All tests passed.

thibmaek and others added 2 commits June 15, 2017 16:02
This creates the --remove|-r command to unlink a previously set hook
Copy link
Owner

@carloscuesta carloscuesta left a comment

Choose a reason for hiding this comment

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

Thanks for sending the PR @thibmaek, small comments! 👍

src/gitmoji.js Outdated
@@ -75,6 +75,24 @@ class GitmojiCli {
};
}

remove() {
const hookFile = 'prepare-commit-msg';
Copy link
Owner

Choose a reason for hiding this comment

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

Can you delete hookFile and path constants from remove() and init methods() and create a global commitHookPath constant outside the class. Code duplication is dangerous! ⚠️

src/gitmoji.js Outdated
@@ -75,6 +75,24 @@ class GitmojiCli {
};
}

remove() {
const hookFile = 'prepare-commit-msg';
const path = `${process.env.PWD}/.git/hooks/${hookFile}`;
Copy link
Owner

Choose a reason for hiding this comment

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

Same as hookFile ☝️

@thibmaek
Copy link
Contributor Author

Sure, think I fixed it now.

@carloscuesta
Copy link
Owner

Great! Take a look at the build @thibmaek the tests are failing 🚨

@thibmaek
Copy link
Contributor Author

Woops, you're right! Totally forgot to update the test property but should be fine now. Also added a path check for gitmoji#remove

Copy link
Owner

@carloscuesta carloscuesta left a comment

Choose a reason for hiding this comment

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

Cool! Thanks for your time @thibmaek 🚀

@carloscuesta carloscuesta merged commit 442ed67 into carloscuesta:master Jun 17, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants