Skip to content

Commit

Permalink
Merge pull request #50 from devops-kung-fu/2.3.0
Browse files Browse the repository at this point in the history
feat: 2.3.0
  • Loading branch information
djschleen authored Jul 6, 2021
2 parents 69541e3 + e65e0bc commit 1c87907
Show file tree
Hide file tree
Showing 17 changed files with 254 additions and 92 deletions.
4 changes: 2 additions & 2 deletions .hookz.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 2.2.0
version: 2.3.0
hooks:
- type: pre-commit
actions:
Expand All @@ -25,7 +25,7 @@
args: ["-ignoretests", "./..."]
- name: "gocyclo: Check cyclomatic complexities"
exec: gocyclo
args: ["-over", "9", "."]
args: ["-over", "7", "."]
- name: "go: Build (Ensure pulled modules do not break the build)"
exec: go
args: ["build", "-v"]
Expand Down
1 change: 1 addition & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

{
"name": "Debug",
"type": "go",
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ To install ```hookz```, [download the latest release](https://github.com/devops
Linux Example:

```bash
sudo chmod +x hookz-2.2.3-linux-amd64
sudo mv hookz-2.2.3-linux-amd64 /usr/local/bin/hookz
sudo chmod +x hookz-2.3.0-linux-amd64
sudo mv hookz-2.3.0-linux-amd64 /usr/local/bin/hookz
```

## Configuration
Expand All @@ -52,7 +52,7 @@ Hookz uses a configuration file to generate hooks in your local git repository.
### Example Configuration

``` yaml
version: 2.2.3
version: 2.3.0
hooks:
- type: pre-commit
actions:
Expand All @@ -77,7 +77,7 @@ hooks:
args: ["add", "."]
```
Hooks will read this example configuration and create a ```pre-commit``` hook and a ```post-commit``` hook based on this yaml.
Hookz will read this example configuration and create a ```pre-commit``` hook and a ```post-commit``` hook based on this yaml.

An action with an ```URL``` will download the binary from the defined URL and configure the hook to execute the command with the defined arguments before a commit happens.

Expand All @@ -87,12 +87,12 @@ __Check out the [tacklebox](tackle/README.md) for a curated collection of action

### Dynamic Architecture URLs

Quite often, downloadable binaries exist for multiple platforms when downloading. For example, [hinge](https://github.com/devops-kung-fu/hinge) is available for multiple architectures such as ```linux```, ```darwin``` (Mac), etc. By using the ```%%PLATFORM%%``` tag in your URL to replace an architecture, the download functionality will retrieve the right binary for your current architecture.
Quite often, downloadable binaries exist for multiple platforms when downloading. In order to get the right architecture for your current platform, Hookz ```v2.3.0``` introduces dynamic architecture URL support. For example, [hinge](https://github.com/devops-kung-fu/hinge) is available for multiple architectures such as ```linux```, ```darwin``` (Mac), etc. By using the ```%%PLATFORM%%``` tag in your URL to replace an architecture, the download functionality will retrieve the right binary for your current architecture.

For example, you can use the following to retrieve the right architecture for [hinge](https://github.com/devops-kung-fu/hinge):
You can use the following to retrieve the right architecture for [hinge](https://github.com/devops-kung-fu/hinge):

``` yaml
version: 2.2.3
version: 2.3.0
hooks:
- type: pre-commit
actions:
Expand Down Expand Up @@ -223,7 +223,7 @@ Check out the collection [here](tackle/README.md).
Assumes `terraform` is in your `PATH` for `fmt`.
```yaml
version: 2.2.3
version: 2.3.0
hooks:
- type: pre-commit
actions:
Expand All @@ -246,7 +246,7 @@ hooks:
### NPM

```yaml
version: 2.2.3
version: 2.3.0
hooks:
- type: pre-commit
actions:
Expand Down
3 changes: 3 additions & 0 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ var (
color.Style{color.FgLightBlue, color.OpBold}.Println("Initializing Hooks")
fmt.Println()
config, err := lib.ReadConfig(fs, version)
if err != nil && err.Error() == "NO_CONFIG" {
os.Exit(1)
}
if lib.IsErrorBool(err, "[ERROR]") {
return
}
Expand Down
4 changes: 4 additions & 0 deletions cmd/reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"fmt"
"os"

"github.com/devops-kung-fu/hookz/lib"
"github.com/gookit/color"
Expand All @@ -22,6 +23,9 @@ var (
return
}
config, err := lib.ReadConfig(fs, version)
if err != nil && err.Error() == "NO_CONFIG" {
os.Exit(1)
}
if lib.IsErrorBool(err, "[ERROR]") {
return
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

var (
version = "2.2.3"
version = "2.3.0"
debug bool
verbose bool
rootCmd = &cobra.Command{
Expand Down
4 changes: 4 additions & 0 deletions cmd/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"fmt"
"os"

"github.com/devops-kung-fu/hookz/lib"
"github.com/gookit/color"
Expand All @@ -18,6 +19,9 @@ var (
color.Style{color.FgLightBlue, color.OpBold}.Println("Update Executables")
fmt.Println()
config, err := lib.ReadConfig(fs, version)
if err != nil && err.Error() == "NO_CONFIG" {
os.Exit(1)
}
if lib.IsErrorBool(err, "[ERROR]") {
return
}
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ module github.com/devops-kung-fu/hookz
go 1.16

require (
github.com/cavaliercoder/grab v2.0.0+incompatible
github.com/dustin/go-humanize v1.0.0
github.com/gookit/color v1.4.2
github.com/jarcoal/httpmock v1.0.8
github.com/segmentio/ksuid v1.0.3
github.com/spf13/afero v1.6.0
github.com/spf13/cobra v1.2.1
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM=
github.com/cavaliercoder/grab v2.0.0+incompatible h1:wZHbBQx56+Yxjx2TCGDcenhh3cJn7cCLMfkEPmySTSE=
github.com/cavaliercoder/grab v2.0.0+incompatible/go.mod h1:tTBkfNqSBfuMmMBFaO2phgyhdYhiZQ/+iXCZDzcDsMI=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
Expand All @@ -61,6 +59,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsr
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
Expand Down Expand Up @@ -165,6 +165,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jarcoal/httpmock v1.0.8 h1:8kI16SoO6LQKgPE7PvQuV+YuD/inwHd7fOOe2zMbo4k=
github.com/jarcoal/httpmock v1.0.8/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik=
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
Expand Down
Loading

0 comments on commit 1c87907

Please sign in to comment.