-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Artur Troian <[email protected]>
- Loading branch information
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
GO111MODULE=on | ||
ROOT_DIR=${VANITY_ROOT} | ||
DEVCACHE_BASE=${VANITY_ROOT}/.cache | ||
DEVCACHE=${DEVCACHE_BASE} | ||
DEVCACHE_BIN=${DEVCACHE}/bin | ||
DEVCACHE_VERSIONS=${DEVCACHE}/versions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
VANITY_ROOT=$(pwd) | ||
export VANITY_ROOT | ||
|
||
dotenv | ||
|
||
VANITY_DIRENV_SET=1 | ||
|
||
export VANITY_DIRENV_SET | ||
|
||
make cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
ifeq (0, $(shell id -u)) | ||
$(warning "make was started with superuser privileges. it may cause issues with direnv") | ||
endif | ||
|
||
ifeq (, $(shell which direnv)) | ||
$(error "No direnv in $(PATH), consider installing. https://direnv.net") | ||
endif | ||
|
||
ifneq (1, $(VANITY_DIRENV_SET)) | ||
$(error "no envrc detected. might need to run \"direnv allow\"") | ||
endif | ||
|
||
# VANITY_ROOT may not be set if environment does not support/use direnv | ||
# in this case define it manually as well as all required env variables | ||
ifndef VANITY_ROOT | ||
$(error "VANITY_ROOT is not set. might need to run \"direnv allow\"") | ||
endif | ||
|
||
VANGEN_VERSION ?= latest | ||
VANGEN := $(DEVCACHE_BIN)/vangen | ||
VANGEN_VERSION_FILE := $(DEVCACHE_VERSIONS)/vangen/$(VANGEN_VERSION) | ||
|
||
$(VANGEN_VERSION_FILE): $(DEVCACHE) | ||
@echo "installing vangen $(VANGEN_VERSION) ..." | ||
rm -f $(VANGEN) | ||
GOBIN=$(DEVCACHE_BIN) go install 4d63.com/vangen@$(VANGEN_VERSION) | ||
rm -rf "$(dir $@)" | ||
mkdir -p "$(dir $@)" | ||
touch $@ | ||
$(VANGEN): $(VANGEN_VERSION_FILE) | ||
|
||
|
||
$(DEVCACHE): | ||
@echo "creating .cache dir structure..." | ||
mkdir -p $@ | ||
mkdir -p $(DEVCACHE_BIN) | ||
mkdir -p $(DEVCACHE_VERSIONS) | ||
|
||
cache: $(DEVCACHE) | ||
|
||
vangen: $(VANGEN) | ||
$(VANGEN) -config vangen.json -out . |