-
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.
Finishing CLI script; improving Makefile
- Loading branch information
1 parent
769a908
commit 5646148
Showing
7 changed files
with
145 additions
and
116 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
tmp/ | ||
nginx/ | ||
out/ | ||
dev/ | ||
.DS_Store | ||
.vagrant/ | ||
.buildpath | ||
|
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 |
---|---|---|
@@ -1,81 +1,51 @@ | ||
PWD = `pwd` | ||
KONG_HOME = `pwd` | ||
|
||
# Dev environment variables | ||
export DAEMON ?= off | ||
export LUA_LIB ?= lua_package_path \"$(PWD)/src/?.lua\;\;\"\; | ||
export LUA_CODE_CACHE ?= on | ||
export KONG_PORT ?= 8000 | ||
export KONG_WEB_PORT ?= 8001 | ||
export DIR ?= $(PWD)/tmp | ||
export KONG_CONF ?= $(DIR)/kong.conf | ||
export SILENT ?= | ||
export DEV_DIR ?= $(KONG_HOME)/dev | ||
export TEST_DIR ?= $(KONG_HOME)/test | ||
export KONG_CONF ?= $(DEV_DIR)/kong-dev.yaml | ||
export DEV_LUA_LIB ?= lua_package_path \"$(KONG_HOME)/src/?.lua\;\;\"\; | ||
|
||
.PHONY: build global test test-web test-all run migrate populate drop | ||
.PHONY: install dev clean reset seed drop test test-integration test-web test-proxy test-all | ||
|
||
global: | ||
install: | ||
@luarocks make kong-*.rockspec --only-server=http://rocks.moonscript.org | ||
|
||
test: | ||
@busted spec/unit | ||
|
||
test-web: | ||
@$(MAKE) build DAEMON=on | ||
@$(MAKE) migrate SILENT=-s | ||
@$(MAKE) run | ||
@$(MAKE) seed SILENT=-s | ||
@busted spec/web/ || (make stop;make drop; exit 1) | ||
@$(MAKE) stop | ||
@$(MAKE) drop SILENT=-s | ||
|
||
test-proxy: | ||
@$(MAKE) build DAEMON=on | ||
@$(MAKE) migrate SILENT=-s | ||
@$(MAKE) run | ||
@$(MAKE) seed SILENT=-s | ||
@busted spec/proxy/ || (make stop;make drop; exit 1) | ||
@$(MAKE) stop | ||
@$(MAKE) drop SILENT=-s | ||
|
||
test-all: | ||
@$(MAKE) build DAEMON=on | ||
@$(MAKE) migrate SILENT=-s | ||
@$(MAKE) run | ||
@$(MAKE) seed SILENT=-s | ||
@busted spec/ || (make stop;make drop; exit 1) | ||
@$(MAKE) stop | ||
@$(MAKE) drop SILENT=-s | ||
dev: | ||
@mkdir -p $(DEV_DIR) | ||
@sed -e "s@lua_package_path.*;@$(DEV_LUA_LIB)@g" $(KONG_HOME)/conf/nginx.conf > $(DEV_DIR)/nginx-dev.conf | ||
@cp $(KONG_HOME)/conf/kong.yaml $(DEV_DIR)/kong-dev.yaml | ||
|
||
migrate: | ||
@scripts/migrate migrate $(SILENT) --conf=$(KONG_CONF) | ||
clean: | ||
@rm -rf $(DEV_DIR) | ||
|
||
reset: | ||
@scripts/migrate reset $(SILENT) --conf=$(KONG_CONF) | ||
@scripts/migrate reset --conf=$(KONG_CONF) | ||
|
||
seed: | ||
@scripts/seed seed $(SILENT) --conf=$(KONG_CONF) | ||
@scripts/seed seed --conf=$(KONG_CONF) | ||
|
||
drop: | ||
@scripts/seed drop $(SILENT) --conf=$(KONG_CONF) | ||
@scripts/seed drop --conf=$(KONG_CONF) | ||
|
||
run: | ||
@nginx -p $(DIR)/nginx -c nginx.conf | ||
test: | ||
@busted spec/unit | ||
|
||
stop: | ||
@nginx -p $(DIR)/nginx -c nginx.conf -s stop | ||
test-integration: | ||
@$(MAKE) dev DEV_DIR=$(TEST_DIR) | ||
@bin/kong -c $(TEST_DIR)/kong-dev.yaml -n $(TEST_DIR)/nginx-dev.conf start > /dev/null | ||
@bin/kong migrate > /dev/null | ||
@$(MAKE) seed > /dev/null | ||
@busted $(FOLDER) || (bin/kong stop > /dev/null;make drop > /dev/null; exit 1) | ||
@bin/kong stop > /dev/null | ||
@$(MAKE) drop > /dev/null | ||
@$(MAKE) clean DEV_DIR=$(TEST_DIR) | ||
|
||
build: | ||
@mkdir -p $(DIR)/nginx/logs | ||
@cp templates/kong.conf $(KONG_CONF) | ||
@echo "" > $(DIR)/nginx/logs/error.log | ||
@echo "" > $(DIR)/nginx/logs/access.log | ||
@sed \ | ||
-e "s/{{DAEMON}}/$(DAEMON)/g" \ | ||
-e "s@{{LUA_LIB_PATH}}@$(LUA_LIB)@g" \ | ||
-e "s/{{LUA_CODE_CACHE}}/$(LUA_CODE_CACHE)/g" \ | ||
-e "s/{{PORT}}/$(KONG_PORT)/g" \ | ||
-e "s/{{WEB_PORT}}/$(KONG_WEB_PORT)/g" \ | ||
-e "s@{{KONG_CONF}}@$(KONG_CONF)@g" \ | ||
templates/nginx.conf > $(DIR)/nginx/nginx.conf; | ||
test-web: | ||
@$(MAKE) test-integration FOLDER=spec/web | ||
|
||
@cp -R src/kong/web/static $(DIR)/nginx | ||
@cp -R src/kong/web/admin $(DIR)/nginx | ||
test-proxy: | ||
@$(MAKE) test-integration FOLDER=spec/proxy | ||
|
||
test-all: | ||
@$(MAKE) test-integration FOLDER=spec/ |
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
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
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
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
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