Makefile reworked.
parent
bbf7a9a80e
commit
16b2869827
|
@ -1,17 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Should we run the build?
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
exec >& 2
|
||||
echo "Usage: $0 <exe>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exe=$1
|
||||
|
||||
# If the binary hasn't already be compiled.
|
||||
[ -f "${exe}" ] || exit 0
|
||||
|
||||
v=`find src/ -type f -newer "${exe}" | wc -l`
|
||||
test "${v}" != "0"
|
59
makefile
59
makefile
|
@ -1,7 +1,6 @@
|
|||
all: build-server
|
||||
|
||||
Q ?= @
|
||||
SHOULD_UPDATE = ./bin/should-update
|
||||
OPTS ?= --progress
|
||||
|
||||
NAME ?= John
|
||||
|
@ -15,6 +14,8 @@ else
|
|||
LOGIN_OPT = -l $(LOGIN)
|
||||
endif
|
||||
|
||||
SOURCE_FILES = $(wildcard src/*.cr src/*/*.cr src/*/*/*.cr)
|
||||
|
||||
##################
|
||||
### SETUP COMMANDS
|
||||
##################
|
||||
|
@ -36,46 +37,32 @@ add-first-user:
|
|||
### REQUEST EXAMPLES
|
||||
####################
|
||||
|
||||
add-user:
|
||||
./bin/authc user add $(NAME) $(EMAIL) $(LOGIN_OPT)
|
||||
|
||||
register:
|
||||
./bin/authc user register $(NAME) $(EMAIL)
|
||||
|
||||
ACTIVATION_KEY ?= put-your-key-here
|
||||
validate:
|
||||
./bin/authc user validate $(NAME) $(ACTIVATION_KEY)
|
||||
|
||||
get-user:
|
||||
./bin/authc user get $(NAME) $(LOGIN_OPT)
|
||||
|
||||
migrate-user:
|
||||
./bin/authc user migrate $(NAME) $(PASSWORD_HASH) $(LOGIN_OPT)
|
||||
add-user:; $(Q)./bin/authc user add $(NAME) $(EMAIL) $(LOGIN_OPT)
|
||||
register:; $(Q)./bin/authc user register $(NAME) $(EMAIL)
|
||||
validate:; $(Q)./bin/authc user validate $(NAME) $(ACTIVATION_KEY)
|
||||
get-user:; $(Q)./bin/authc user get $(NAME) $(LOGIN_OPT)
|
||||
|
||||
USER_DB ?= /tmp/authd-migration-user-db.txt
|
||||
migrate-all-users:
|
||||
./bin/authc migration-script $(USER_DB) $(LOGIN_OPT)
|
||||
migrate-user:; ./bin/authc user migrate $(NAME) $(PASSWORD_HASH) $(LOGIN_OPT)
|
||||
migrate-all-users:; ./bin/authc migration-script $(USER_DB) $(LOGIN_OPT)
|
||||
|
||||
SERVICE ?= 'auth'
|
||||
RESOURCE ?= '*'
|
||||
UID ?= 1000
|
||||
permission-check:
|
||||
./bin/authc permission check $(UID) $(SERVICE) $(RESOURCE) $(LOGIN_OPT)
|
||||
|
||||
PERMISSION ?= Read
|
||||
permission-set:
|
||||
./bin/authc permission set $(UID) $(SERVICE) $(RESOURCE) $(PERMISSION) $(LOGIN_OPT)
|
||||
permission-check:; ./bin/authc permission check $(UID) $(SERVICE) $(RESOURCE) $(LOGIN_OPT)
|
||||
permission-set:; ./bin/authc permission set $(UID) $(SERVICE) $(RESOURCE) $(PERMISSION) $(LOGIN_OPT)
|
||||
|
||||
|
||||
###################
|
||||
### DEVELOPER TOOLS
|
||||
###################
|
||||
|
||||
build-server:
|
||||
$(Q)-$(SHOULD_UPDATE) bin/authd && shards build authd $(OPTS)
|
||||
build-client:
|
||||
$(Q)-$(SHOULD_UPDATE) bin/authc && shards build authc $(OPTS)
|
||||
|
||||
bin/authd: $(SOURCE_FILES); $(Q)shards build authd $(OPTS)
|
||||
bin/authc: $(SOURCE_FILES); $(Q)shards build authc $(OPTS)
|
||||
build-server: bin/authd
|
||||
build-client: bin/authc
|
||||
build: build-server build-client
|
||||
|
||||
doc:
|
||||
|
@ -88,18 +75,12 @@ DIR ?= docs
|
|||
serve-doc:
|
||||
darkhttpd $(DIR) --addr $(HTTPD_ADDR) --port $(HTTPD_PORT) --log $(HTTPD_ACCESS_LOGS)
|
||||
|
||||
print-messages:
|
||||
cat src/requests/*.cr | ./bin/get-messages.awk
|
||||
print-message-numbers:
|
||||
make -s print-messages | grep -E "^[0-9]" | sort -n
|
||||
print-messages-without-comments:
|
||||
make -s print-messages | grep -vE '^[[:blank:]]+#'
|
||||
print-response-messages:
|
||||
cat src/responses/*.cr | ./bin/get-messages.awk
|
||||
print-response-message-numbers:
|
||||
make -s print-response-messages | grep -E "^[0-9]" | sort -n
|
||||
print-response-messages-without-comments:
|
||||
make -s print-response-messages | grep -vE '^[[:blank:]]+#'
|
||||
print-messages:; cat src/requests/*.cr | ./bin/get-messages.awk
|
||||
print-message-numbers:; make -s print-messages | grep -E "^[0-9]" | sort -n
|
||||
print-messages-no-comments:; make -s print-messages | grep -vE '^[[:blank:]]+#'
|
||||
print-response-messages:; cat src/responses/*.cr | ./bin/get-messages.awk
|
||||
print-response-message-numbers:; make -s print-response-messages | grep -E "^[0-9]" | sort -n
|
||||
print-response-messages-no-comments:; make -s print-response-messages | grep -vE '^[[:blank:]]+#'
|
||||
|
||||
wipe-db:
|
||||
rm -r $(DATA_DIRECTORY)
|
||||
|
|
Loading…
Reference in New Issue