Skip to content

Commit

Permalink
rename hookah to lefthook
Browse files Browse the repository at this point in the history
  • Loading branch information
A.A.Abroskin committed Apr 17, 2019
1 parent 632335c commit 6970861
Show file tree
Hide file tree
Showing 26 changed files with 184 additions and 182 deletions.
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.vscode/
.hookah-local/
.hookah/
/hookah-local.yml
/hookah.yml
hookah
.lefthook-local/
.lefthook/
/lefthook-local.yml
/lefthook.yml
lefthook

tmp/
dist/
15 changes: 8 additions & 7 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
project_name: lefthook
before:
hooks:
- go generate ./...
Expand Down Expand Up @@ -35,26 +36,26 @@ changelog:
brew:
github:
owner: Arkweid
name: homebrew-hookah
homepage: "https://github.com/Arkweid/hookah"
description: "Simple git hooks manager"
name: homebrew-lefthook
homepage: "https://github.com/Arkweid/lefthook"
description: "Lefthook a single dependency-free binary to manage all your git hooks that works with any language in any environment, and in all common team workflows"
folder: Formula
test: |
system "#{bin}/hookah -v"
system "#{bin}/lefthook version"
snapcraft:
name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
summary: For rule your git hooks
description: |
Simple git hooks manager.
Lefthook a single dependency-free binary to manage all your git hooks that works with any language in any environment, and in all common team workflows.
grade: stable
confinement: strict
publish: true

nfpm:
name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
homepage: https://github.com/Arkweid/hookah
description: Simple git hooks manager
homepage: https://github.com/Arkweid/lefthook
description: Lefthook a single dependency-free binary to manage all your git hooks that works with any language in any environment, and in all common team workflows
maintainer: Alexander Abroskin <arkweid@evilmartians.com>
license: MIT
vendor: Arkweid
Expand Down
94 changes: 47 additions & 47 deletions .npm/README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
![Build Status](https://api.travis-ci.org/Arkweid/hookah.svg?branch=master)
![Build Status](https://api.travis-ci.org/Arkweid/lefthook.svg?branch=master)

# Hookah
# Lefthook

Hookah a single dependency-free binary to manage all your git hooks that works with any language in any environment, and in all common team workflows.
Lefthook a single dependency-free binary to manage all your git hooks that works with any language in any environment, and in all common team workflows.

<a href="https://evilmartians.com/?utm_source=hookah">
<a href="https://evilmartians.com/?utm_source=lefthook">
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54"></a>

## Installation

Add Hookah to your system or build it from sources.
Add Lefthook to your system or build it from sources.

### go
```bash
go get github.com/Arkweid/hookah
go get github.com/Arkweid/lefthook
```

### npm and yarn
```bash
npm i @arkweid/hookah --save-dev
npm i @arkweid/lefthook --save-dev
# or yarn:
yarn add -D @arkweid/hookah
yarn add -D @arkweid/lefthook
```
NOTE: if you install it this way you should call it with `npx` or `yarn` for all listed examples below.

### Homebrew for macOS
```bash
brew install Arkweid/hookah/hookah
brew install Arkweid/lefthook/lefthook
```

### snap for Ubuntu
```bash
sudo snap install --devmode hookah
sudo snap install --devmode lefthook
```

Or take it from [binaries](https://github.com/Arkweid/hookah/releases) and install manualy
Or take it from [binaries](https://github.com/Arkweid/lefthook/releases) and install manualy

## Scenarios

Expand All @@ -44,18 +44,18 @@ Or take it from [binaries](https://github.com/Arkweid/hookah/releases) and insta

Go to your project directory and run following commands:

Add configuration file `hookah.yml`:
Add configuration file `lefthook.yml`:
```bash
hookah install
lefthook install
```

Register desired githook. In our example it `pre-push` githook:
```bash
hookah add pre-push
lefthook add pre-push
```
[Here](https://git-scm.com/docs/githooks) you can refresh your knowledge about githooks.

Describe pre-push commands in `hookah.yml`:
Describe pre-push commands in `lefthook.yml`:
```yml
pre-push: # githook name
commands: # list of commands
Expand All @@ -65,18 +65,18 @@ pre-push: # githook name
That all! Now on `git push` the `yarn audit` command will run.
If it fail the `git push` will be interrupt.

### Project with existed hookah
### Project with existed lefthook
Run:
```bash
hookah install
lefthook install
```
Hookah wiil read existed hook groups and reproduce hooks in `.git/hooks` directory.
lefthook wiil read existed hook groups and reproduce hooks in `.git/hooks` directory.

## More options

## Filters for list of files
```yml
# hookah.yml
# lefthook.yml
pre-commit:
commands:
Expand All @@ -96,7 +96,7 @@ pre-commit:
## Custom list of files
You can describe a custom list of files. Common scenario for pre-push "list of all changed files between current branch and master branch" you can do it this way:
```yml
# hookah.yml
# lefthook.yml
pre-push:
commands:
Expand All @@ -108,15 +108,15 @@ pre-push:
`{files}` - shorthand for custom list of files

## Scripts
Hookah also can run script files. Common scenario for `commit-msg` "check commit text template".
Lefthook also can run script files. Common scenario for `commit-msg` "check commit text template".
Register `commit-msg` githook:
```bash
hookah add -d commit-msg
lefthook add -d commit-msg
```
This command also create two dirs `.hookah/commit-msg` and `.hookah-local/commit-msg`.
First dir for common project level scripts. Second one for your personal scripts. Add dir`.hookah-local` to `.gitignore`.
This command also create two dirs `.lefthook/commit-msg` and `.lefthook-local/commit-msg`.
First dir for common project level scripts. Second one for your personal scripts. Add dir`.lefthook-local` to `.gitignore`.

Create template_checker script file `.hookah/commit-msg/template_checker`:
Create template_checker script file `.lefthook/commit-msg/template_checker`:
```bash
INPUT_FILE=$1
START_LINE=`head -n1 $INPUT_FILE`
Expand All @@ -126,9 +126,9 @@ if ! [[ "$START_LINE" =~ $PATTERN ]]; then
exit 1
fi
```
We need to know which program can execute the code in `template_checker`. Describe it in `hookah.yml`:
We need to know which program can execute the code in `template_checker`. Describe it in `lefthook.yml`:
```yml
# hookah.yml
# lefthook.yml

commit-msg:
scripts:
Expand All @@ -140,7 +140,7 @@ Now when you try to commit `git commit -m "haha bad commit text"` script `templa

## Tags
If we have a lot of commands and scripts we can divide them by tags and run only relevent for our work commands.
For example we have `hookah.yml` like this:
For example we have `lefthook.yml` like this:
```yml
pre-push:
commands:
Expand All @@ -152,19 +152,19 @@ pre-push:
run: bundle audit
```

We provide `hookah-local.yml` as local config. Options in this file overwrite options in `hookah.yml`. s Add it to `.gitignore`
We provide `lefthook-local.yml` as local config. Options in this file overwrite options in `lefthook.yml`. s Add it to `.gitignore`

You can skip commands by tags:
```yml
# hookah-local.yml
# lefthook-local.yml
pre-push:
exlude_tags:
- frontend
```
Also you can skip commands by `skip` option:
```yml
# hookah-local.yml
# lefthook-local.yml
pre-push:
commands:
Expand All @@ -176,7 +176,7 @@ pre-push:
If some runner installed in docker you can wrap it in docker runner:

```yml
# hookah.yml
# lefthook.yml
pre-commit:
scripts:
Expand All @@ -185,19 +185,19 @@ pre-commit:
```

```yml
# hookah-local.yml
# lefthook-local.yml
pre-commit:
scripts:
"good_job.js":
runner: docker exec -it --rm <container_id_or_name> {cmd}
```
`{cmd}` - shorthand for command from `hookah.yml`
`{cmd}` - shorthand for command from `lefthook.yml`

## Run githook group directly

```bash
hookah run pre-commit
lefthook run pre-commit
```

## Parallel execution
Expand All @@ -213,9 +213,9 @@ yarn eslint --ext .es6 plugins/**/test/javascripts && \
yarn eslint app/assets/javascripts test/javascripts
```
Rewrite it in hookah custom group. We call it `lint`:
Rewrite it in lefthook custom group. We call it `lint`:
```yml
# hookah.yml
# lefthook.yml
lint:
commands:
Expand All @@ -238,13 +238,13 @@ lint:
```
Then call this group directly:
```
hookah run lint
lefthook run lint
```

## Complete example

```yml
# hookah.yml
# lefthook.yml

pre-commit:
commands:
Expand Down Expand Up @@ -272,7 +272,7 @@ pre-commit:
```
```yml
# hookah-local.yml
# lefthook-local.yml

pre-commit:
exclude_tags:
Expand All @@ -288,10 +288,10 @@ pre-commit:
## Skip hoookah execution
We have env `HOOKAH=0` for that
We have env `LEFTHOOK=0` for that

```bash
HOOKAH=0 git commit -am "Hookah skipped"
LEFTHOOK=0 git commit -am "Lefthook skipped"
```

## Skip some tags on the fly
Expand All @@ -315,20 +315,20 @@ SHA1=$3
## Change directory for script files
You can do this through this config keys:
```yml
# hookah.yml
# lefthook.yml
source_dir: ".hookah"
source_dir_local: ".hookah-local"
source_dir: ".lefthook"
source_dir_local: ".lefthook-local"
```

## Version

```bash
hookah version
lefthook version
```

## Uninstall

```bash
hookah uninstall
lefthook uninstall
```
Binary file modified .npm/bin/hookah-linux
Binary file not shown.
Binary file modified .npm/bin/hookah-mac
Binary file not shown.
Binary file modified .npm/bin/hookah-win.exe
Binary file not shown.
6 changes: 3 additions & 3 deletions .npm/bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ function spawnCommand(binaryExecutable) {
}

if (process.platform === 'darwin') {
spawnCommand('hookah-mac');
spawnCommand('lefthook-mac');
} else if (process.platform === 'linux') {
spawnCommand('hookah-linux');
spawnCommand('lefthook-linux');
} else if (process.platform === 'win32') {
spawnCommand('hookah-win.exe');
spawnCommand('lefthook-win.exe');
} else {
console.log("Unsupported OS");
process.exit(1);
Expand Down
12 changes: 6 additions & 6 deletions .npm/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@arkweid/hookah",
"version": "0.2.3",
"name": "@arkweid/lefthook",
"version": "0.3.0",
"description": "Simple git hooks manager",
"main": "index.js",
"bin": {
"hookah": "./bin/index.js"
"lefthook": "./bin/index.js"
},
"repository": "https://github.com/Arkweid/hookah",
"repository": "https://github.com/Arkweid/lefthook",
"keywords": [
"git",
"hook",
Expand All @@ -15,9 +15,9 @@
"author": "Arkweid",
"license": "MIT",
"bugs": {
"url": "https://github.com/Arkweid/hookah/issues"
"url": "https://github.com/Arkweid/lefthook/issues"
},
"homepage": "https://github.com/Arkweid/hookah#readme",
"homepage": "https://github.com/Arkweid/lefthook#readme",
"os": [
"darwin",
"linux",
Expand Down
Loading

0 comments on commit 6970861

Please sign in to comment.