git-guppy-pre-commit-hook
v0.1.0
Published
The (pre-post) commit hooks for the Git Guppy module for your gulp workflows.
Downloads
10
Maintainers
Readme
git-guppy
Git pre-commit hook for Git Guppy, a Simple git-hook integration for your gulp workflows.
guppy streamlines and extends your git-hooks by integrating them with your gulp workflow. Git-hooks can now be managed through npm, allowing them to automatically be installed and updated. And because they integrate with gulp, it's easy to modify the workflow and even combine hooks with your other gulp tasks.
guppy leverages these powerful existing systems as its backbone, allowing guppy (and therefore your git-hooks) to remain as simple and lightweight as possible through interfaces you're already familiar with.
Pre-commit hook
Read more about this hook at http://git-scm.com/docs/githooks#_pre_commit.
- By-passing it: using
git commit --no-verify
when installed and configured.
Install
Install with npm:
$ npm install --save git-guppy-pre-commit-hook
npm http GET https://registry.npmjs.org/named-regexp
npm http 304 https://registry.npmjs.org/named-regexp
npm http GET https://registry.npmjs.org/lazypipe
npm http GET https://registry.npmjs.org/lodash
npm http GET https://registry.npmjs.org/shelljs
npm http 304 https://registry.npmjs.org/lodash
npm http 304 https://registry.npmjs.org/shelljs
npm http 304 https://registry.npmjs.org/lazypipe
npm http GET https://registry.npmjs.org/stream-combiner
npm http 304 https://registry.npmjs.org/stream-combiner
npm http GET https://registry.npmjs.org/duplexer
npm http GET https://registry.npmjs.org/through
npm http 304 https://registry.npmjs.org/duplexer
npm http 304 https://registry.npmjs.org/through
> [email protected] postinstall /tmp/sp-quality/node_modules/git-guppy-pre-commit-hook/node_modules/git-guppy
> scripts/install.js
/tmp/sp-quality
Thanks for installing git-guppy! Install any of the hooks available now!
npm install --save git-guppy-pre-commit git-guppy-pre-commit git-guppy-post-commit ...
Go to https://github.com/therealklanni/git-guppy for a complete list!
> [email protected] postinstall /tmp/sp-quality/node_modules/git-guppy-pre-commit-hook
> ../git-guppy/scripts/install.js pre-commit
/tmp/sp-quality
pre-commit installed successfully
[email protected] node_modules/git-guppy-pre-commit-hook
├── [email protected]
└── [email protected] ([email protected], [email protected], [email protected])
After the installation is complete, the hook is installed at APP/.git/hook/pre-commit
.
Usage
Git integration
Automatic!
The actual script that git will run to trigger guppy's hook will automatically be
installed to your APP/.git/hooks/
directory. These are just a wrapper for invoking
the gulp tasks that guppy registers.
You can install guppy-hooks via npm
Gulp integration
Usually, pre-commit hooks can be used to trigger lint, code check, among other things. The following example creates a task called "check", which uses lint and jscs to verify the code prior to a commit. If the verification fails, the commit process halts as expected. If it passes, profit! and commit!
var gulp = require("gulp");
gulp.task("check", function() {
// Check all the source and the test cases together
return gulp.src(appSourcePaths.concat(testSourcePaths))
.pipe(jshint(SP_QUALITY_MODULE_CONFIG_DIR + "/.jshintrc"))
.pipe(jshint.reporter(stylish))
.pipe(jscs(SP_QUALITY_MODULE_CONFIG_DIR + "/.jscsrc"))
.on("error", function() {
process.exit(-1);
})
.on("end", function() {
process.exit();
});
});
// define guppy and its dependency hook to pre-commit.
var guppy = require("guppy);
guppy.init(gulp)
guppy.tasks["pre-commit"].dep.push("check")
An attempt to commit will result in failure if the code does not pass the check.
mdesales@ubuntu [11/16/201416:28:31] /tmp/sp-quality (master *+) $ git commit
[16:28:34] Using gulpfile /tmp/sp-quality/Gulpfile.js
[16:28:34] Starting 'check'...
[16:28:35] Finished 'check' after 69 ms
[16:28:35] Starting 'pre-commit'...
/tmp/sp-quality/src/index.js
line 34 col 33 Missing semicolon.
line 52 col 19 Missing semicolon.
line 53 col 46 Missing semicolon.
✖ 3 problems
However, you will be able to commit the code if the check passes!
mdesales@ubuntu [11/16/201416:26:57] /tmp/sp-quality (master *+) $ git commit
[16:27:02] Using gulpfile /tmp/sp-quality/Gulpfile.js
[16:27:02] Starting 'check'...
[16:27:02] Finished 'check' after 71 ms
[16:27:02] Starting 'pre-commit'...
If you are certain to by-pass the errors, you can use git's switch --no-verify. That way, the hook will NOT even be triggered!
Git Guppy Core
For full detail about the core of the project, please go to https://github.com/therealklanni/git-guppy.
Authors
Kevin Lanni
** Modular Hooks Architecture **
License
Copyright (c) 2014 Marcello de Sales, contributors. Released under the MIT license
This file was generated by gulp-verb on August 10, 2014.