File tree Expand file tree Collapse file tree 2 files changed +36
-12
lines changed Expand file tree Collapse file tree 2 files changed +36
-12
lines changed Original file line number Diff line number Diff line change @@ -11,21 +11,14 @@ long.
11
11
12
12
## Installation
13
13
14
- Execute the command for your platform within the root folder of your git
15
- project. This will download the latest release, puts it in the ` ./.git/hooks/ `
16
- folder and makes it executable. See git documentation about hooks for
14
+ Execute the command within the root folder of your git
15
+ project. This will download the installation script that determines the OS and
16
+ downloads the latest binary. Afterwards, the initialization is started and the
17
+ corresponding hook files are prepared. See git documentation about hooks for
17
18
further [ reference] ( https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks ) .
18
19
19
- ### MacOS
20
-
21
- ``` shell
22
- curl -o .git/hooks/commit-msg -L https://github.com/rockstaedt/commit-message-check/releases/download/v0.0.4/commit-message-check-v0.0.4-darwin-arm64 && chmod +x .git/hooks/commit-msg
23
- ```
24
-
25
- ### Linux
26
-
27
20
``` shell
28
- curl -o .git/hooks/commit-msg -L https://github. com/rockstaedt/commit-message-check/releases/download/v0.0.4/commit-message-check-v0.0.4-linux-amd64 && chmod +x .git/hooks/commit-msg
21
+ curl -o install.sh -L https://raw.githubusercontent. com/rockstaedt/commit-message-check/main/install.sh && chmod +x ./install.sh && ./install.sh
29
22
```
30
23
31
24
## Usage
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ version=$( curl --silent " https://api.github.com/repos/rockstaedt/commit-message-check/releases/latest" |
4
+ grep ' "tag_name":' |
5
+ sed -E ' s/.*"([^"]+)".*/\1/' )
6
+
7
+ echo " -> Installing commit-message-check ${version} "
8
+
9
+ if [[ " $OSTYPE " == " linux-gnu" * ]]; then
10
+ os=" linux"
11
+ elif [[ " $OSTYPE " == " darwin" * ]]; then
12
+ os=" darwin"
13
+ else
14
+ echo " ERROR - Could not determine operating system. Please download binary manually."
15
+ exit
16
+ fi
17
+
18
+ os=" ${os} -$( uname -m) "
19
+ binary=" commit-message-check-${version} -${os} "
20
+ url=" https://github.com/rockstaedt/commit-message-check/releases/latest/download/${binary} "
21
+
22
+ curl -o commit-message-check -L $url && chmod +x ./commit-message-check
23
+
24
+ if ! (grep -Fxq " commit-message-check" .gitignore); then
25
+ read -e -p " Do you want to add the binary to gitignore? (y/n) " choice
26
+ [[ " $choice " == [Yy]* ]] && echo ' commit-message-check' >> .gitignore
27
+ fi
28
+
29
+ ./commit-message-check init
30
+
31
+ rm ./install.sh
You can’t perform that action at this time.
0 commit comments