Skip to content

Commit 7dc23a6

Browse files
author
Franz Josef Kaiser
committed
Merge branch 'dev'
2 parents d56bb52 + c109eca commit 7dc23a6

File tree

1 file changed

+66
-29
lines changed

1 file changed

+66
-29
lines changed

README.md

Lines changed: 66 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,20 @@
77
> A Grunt plugin to help bind Grunt tasks to Git hooks
88
99
## Getting Started
10-
This plugin requires Grunt `~0.4.1`
10+
This plugin requires at least Grunt `~0.4.1`
1111

12-
If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
12+
If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the
13+
[Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to
14+
create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and
15+
use Grunt plugins. Once you're familiar with that process, you may install this
16+
plugin with this command:
1317

1418
```shell
1519
npm install grunt-githooks --save-dev
1620
```
1721

18-
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
22+
Once the plugin has been installed, it may be enabled inside your
23+
Gruntfile with this line of JavaScript:
1924

2025
```js
2126
grunt.loadNpmTasks('grunt-githooks');
@@ -24,7 +29,8 @@ grunt.loadNpmTasks('grunt-githooks');
2429
## The "githooks" task
2530

2631
### Overview
27-
In your project's Gruntfile, add a section named `githooks` to the data object passed into `grunt.initConfig()`.
32+
In your project's Gruntfile, add a section named `githooks` to the data
33+
object passed into `grunt.initConfig()`.
2834

2935
```js
3036
grunt.initConfig({
@@ -44,9 +50,10 @@ grunt.initConfig({
4450

4551
#### Defining a few hooks
4652

47-
Hooks are listed as keys of your target configuration.
48-
**Any key other than `option`** is considered the name of a hook you want to create.
49-
The simplest way to define a hook is to provide a **space-separated list of the tasks you want the hook to run as the value**.
53+
Hooks are listed as keys of your target configuration. **Any key other than
54+
`option`** is considered the name of a hook you want to create. The simplest way
55+
to define a hook is to provide a **space-separated list of the tasks you want
56+
the hook to run as the value**.
5057

5158
For example:
5259
```js
@@ -60,12 +67,15 @@ grunt.initConfig({
6067
});
6168
```
6269

63-
The plugin warns you if the name matches one of the [hooks announced in the Git documentation](https://www.kernel.org/pub/software/scm/git/docs/githooks.html).
64-
It will still create the hook, though, in case Git introduces new hooks in the future.
70+
The plugin warns you if the name matches one of the
71+
[hooks announced in the Git documentation](https://www.kernel.org/pub/software/scm/git/docs/githooks.html).
72+
It will still create the hook, though, in case Git introduces new hooks
73+
in the future.
6574

6675
#### Hook specific options
6776

68-
If you need to override a few options for a given hook only, you can *use an Object instead of a String*.
77+
If you need to override a few options for a given hook only, you can *use an
78+
Object instead of a String*.
6979
The `taskNames` property will then correspond to the tasks you want to run.
7080
Any other key will be merged into the options.
7181

@@ -93,9 +103,10 @@ grunt.initConfig({
93103

94104
#### Working with existing hooks
95105

96-
If you happen to have existing hooks in your hook folder, the plugin *appends the code launching Grunt* at the end of your hooks.
97-
You can also insert marker comments in your hooks to specify exactly where you want them inserted.
98-
Your existing hook would look something like this:
106+
If you happen to have existing hooks in your hook folder, the plugin *appends
107+
the code launching Grunt* at the end of your hooks. You can also insert marker
108+
comments in your hooks to specify exactly where you want them inserted. Your
109+
existing hook would look something like this:
99110

100111
```js
101112
// Some code run before Grunt starts
@@ -105,14 +116,16 @@ Your existing hook would look something like this:
105116
// Some code run after Grunt starts
106117
```
107118

108-
The markers get automatically inserted when the plugin appends code, so hooks get updated cleanly the next time you run `grunt githooks`.
119+
The markers get automatically inserted when the plugin appends code, so hooks
120+
get updated cleanly the next time you run `grunt githooks`.
109121

110122
#### Customising hook output
111123

112-
By default, the plugin generate NodeJS scripts for the hooks.
113-
Reasonning behind this is that creating Shell scripts won't work well for people using Windows.
114-
Plus, NodeJS is already installed as Grunt kinda needs it.
115-
However, you're not tied to it and you can customise the generated script entirely. In case of a Shell script:
124+
By default, the plugin generate NodeJS scripts for the hooks. Reasoning behind
125+
this is that creating Shell scripts won't work well for people using Windows.
126+
Plus, NodeJS is already installed as Grunt kinda needs it. However, you're not
127+
tied to it and you can customise the generated script entirely. In case of
128+
a Shell script:
116129

117130
```js
118131
grunt.initConfig({
@@ -144,9 +157,11 @@ In the template, you've got access to the following variables:
144157

145158
#### Extending the plugin
146159

147-
Pretty annoying when you're using a library that's missing the exact extension point you need to tweak its functionalities?
148-
`grunt-githooks` is based on a lot of small functions and most of them are exposed so you can override them.
149-
If you need feel, free to tinker with the internals (at your own risk though ;)). Could be something along:
160+
Pretty annoying when you're using a library that's missing the exact extension
161+
point you need to tweak its functionalities? `grunt-githooks` is based on a lot
162+
of small functions and most of them are exposed so you can override them. If you
163+
need feel, free to tinker with the internals (at your own risk though ;)).
164+
Could be something along:
150165

151166
```js
152167
var gruntGithooks = require('grunt-githooks/tasks/githooks');
@@ -190,8 +205,9 @@ code in it (to avoid inserting Node code in a Python hook for example).
190205
Type: `String`
191206

192207
Path to the Handlebars template used to generate the code that will run Grunt
193-
in the hook. Default template is the `node.js.hb` file located in the `templates` folder of the plugin.
194-
It also contains a `shell.hb` file with the template for a shell script hook.
208+
in the hook. Default template is the `node.js.hb` file located in the `templates`
209+
folder of the plugin. It also contains a `shell.hb` file with the template for a
210+
shell script hook.
195211

196212
> **Note**: Handlebars escapes HTML special characters if you use only two curly braces to insert
197213
> a variable in your template. Make sure you use three `{{{my_var}}}` if you need to insert variable
@@ -205,16 +221,18 @@ Default: `'// GRUNT-GITHOOKS START'`
205221
Type: `String`
206222
Default: `'// GRUNT-GITHOOKS END'`
207223

208-
`startMarker` and `endMarker` are markers the plugin use to know where to insert code if a hook already exist.
209-
If the existing hook doesn't have these markers, the code will simply be appended.
224+
`startMarker` and `endMarker` are markers the plugin use to know where to insert
225+
code if a hook already exist. If the existing hook doesn't have these markers,
226+
the code will simply be appended.
210227

211228
#### preventExit
212229
Type: `Boolean`
213230
Default `false`
214231

215-
By default, the inserted code will exit the process after Grunt has run, using a -1 exit code if the task(s) failed.
216-
If you're inserting the code running Grunt in the middle of an existing hook,
217-
you might want to disable this so any code after what was inserted by the plugin runs.
232+
By default, the inserted code will exit the process after Grunt has run, using
233+
a -1 exit code if the task(s) failed. If you're inserting the code running Grunt
234+
in the middle of an existing hook, you might want to disable this so any code
235+
after what was inserted by the plugin runs.
218236

219237
#### dest
220238
Type: `String`
@@ -226,8 +244,27 @@ Comes in handy if your Gruntfile is not at the root of your Git project.
226244

227245
## Contributing
228246

229-
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).
247+
In lieu of a formal style-guide, take care to maintain the existing coding style.
248+
Please file a Pull Request along your issues.
230249

250+
* Add unit tests for any new or changed functionality.
251+
* Lint and test your code using [Grunt](http://gruntjs.com/).
252+
* Keep the line length at 80-100 characters per line.
253+
254+
### File a Pull Request
255+
256+
The process actually is quite simple:
257+
258+
1. Please check out your changes on a separate branch named `issue-{$integer}` and commit against that one.
259+
1. When your tests pass and are green, merge to `dev` using `--no-ff` so we have a separate commit for that merge.
260+
1. After the review on `dev`, we can merge to `master`, again using `--no-ff`.
261+
1. The merge to `master` will get tagged. We use the [SemVer standard](http://semver.org), so _no_ leading `v`.
262+
263+
If your PR is successful, you will get added as contributor to the repo. We
264+
trust you after your first PR made it into the repo and you then have access
265+
for further changes, handling issues, etc. So the *important* thing is to add
266+
your name to the `package.json` array of `contributors` when changing or adding
267+
some code for a PR. Please do that in a separate commit.
231268

232269
## Release History
233270

0 commit comments

Comments
 (0)