Skip to content

Commit 041b24e

Browse files
author
Adrián Quintás
committed
Support all kind of git hooks
1 parent e60a4c4 commit 041b24e

File tree

5 files changed

+34
-22
lines changed

5 files changed

+34
-22
lines changed

README.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
Installs [git hooks](https://git-scm.com/docs/githooks) that will run in your Elixir project.
1111

12+
Any git hook type is supported, [check here the hooks list](https://git-scm.com/docs/githooks).
13+
1214
## Table of Contents
1315

1416
- [Installation](#installation)
@@ -27,7 +29,7 @@ Add to dependencies:
2729

2830
```elixir
2931
def deps do
30-
[{:git_hooks, "~> 0.1.2"}]
32+
[{:git_hooks, "~> 0.2.0"}]
3133
end
3234
```
3335

@@ -84,16 +86,6 @@ config :git_hooks,
8486

8587
## Execution
8688

87-
### Supported hooks
88-
89-
Currently, in terms of simplifying the usage of this library, the git hooks are:
90-
* pre_commit
91-
* pre_push
92-
* pre_rebase
93-
* pre_receive
94-
* pre_applypatch
95-
* post_update
96-
9789
### Automatic execution
9890

9991
The configured mix tasks will run automatically for each [git hook](https://git-scm.com/docs/githooks#_hooks).

coveralls.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"skip_files": [
3+
"lib/mix/tasks/git_hooks/install.ex"
4+
],
5+
"coverage_options": {
6+
"minimum_coverage": 90
7+
}
8+
}

lib/config/config.ex

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,25 @@ defmodule GitHooks.Config do
33

44
@supported_hooks [
55
:pre_commit,
6-
:pre_push,
6+
:prepare_commit_msg,
7+
:commit_msg,
8+
:post_commit,
79
:pre_rebase,
810
:pre_receive,
11+
:post_receive,
12+
:post_checkout,
13+
:post_merge,
14+
:pre_push,
15+
:push_to_checkout,
916
:pre_applypatch,
10-
:post_update
17+
:applypatch_msg,
18+
:post_applypatch,
19+
:update,
20+
:post_update,
21+
:pre_auto_gc,
22+
:post_rewrite,
23+
:sendemail_validate,
24+
:fsmonitor_watchman
1125
]
1226

1327
@spec supported_hooks() :: list(atom)

lib/mix/tasks/git_hooks/run.ex

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@ defmodule Mix.Tasks.GitHooks.Run do
44
@moduledoc """
55
Runs all the configured mix tasks for a given git hook.
66
7-
The supported git hooks are:
8-
* pre_commit
9-
* pre_push
10-
* pre_rebase
11-
* pre_receive
12-
* pre_applypatch
13-
* post_update
7+
Any [git hook](https://git-scm.com/docs/githooks) is supported.
148
15-
For example, to run the pre_commit hook tasks run:
9+
For example, to run the `pre_commit` hook tasks run:
1610
1711
`mix git_hooks.run pre_commit`
12+
13+
Or you can also all the configured hooks with:
14+
15+
`mix git_hooks.run all`
1816
"""
1917

2018
use Mix.Task

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule GitHooks.MixProject do
33

44
use Mix.Project
55

6-
@version "0.1.2"
6+
@version "0.2.0"
77

88
def project do
99
[

0 commit comments

Comments
 (0)