Skip to content

Commit

Permalink
Manage git hooks via Makefile init target
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanjswift committed Mar 14, 2021
1 parent 1a98768 commit 3959102
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#/bin/sh
yarn pretty-quick --staged
cargo fmt
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ LAMBDA_SRC := $(shell find -E $(LAMBDA) -regex '.*\.rs')
SHARED=./email_shared
SHARED_SRC := $(shell find -E $(SHARED) -regex '.*\.rs')

.PHONY: all broker clean lambda test
.PHONY: all broker clean init lambda test

all: broker lambda

broker: target/release/email_broker

init: .git/config

lambda: target/release/email_lambda

clean:
Expand All @@ -33,7 +35,10 @@ clean:
test: $(SHARED_SRC) $(BROKER_SRC) $(LAMBDA_SRC)
cargo test

Cargo.lock: $(CARGO_TOML)
.git/config: .githooks/*
git config core.hooksPath .githooks

Cargo.lock: $(CARGO_TOML) init
cargo check
@touch -mr $(shell ls -Atd $? | head -1) $@

Expand Down

0 comments on commit 3959102

Please sign in to comment.