-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (44 loc) · 1.45 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
DEV_ROCKS = busted luacheck lua-llthreads2
BUSTED_ARGS ?= -o gtest -v --exclude-tags=ci
TEST_CMD ?= bin/busted $(BUSTED_ARGS)
KONG_PATH ?= bin/kong
PLUGIN_NAME := kong-plugin-html-replacer
.PHONY: install uninstall dev lint test test-integration test-plugins test-all clean
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
current_dir := $(dir $(mkfile_path))
DEV_PACKAGE_PATH := $(current_dir)lua_modules/share/lua/5.1/?
define set_env
@eval $$(luarocks path); \
LUA_PATH="$(DEV_PACKAGE_PATH).lua;$$LUA_PATH" LUA_CPATH="$(DEV_PACKAGE_PATH).so;$$LUA_CPATH"; \
# cd $(KONG_PATH);
endef
lint:
@luacheck -q . \
--exclude-files 'kong/vendor/**/*.lua' \
--exclude-files 'spec/fixtures/**' \
--exclude-files 'spec/helpers.lua' \
--std 'ngx_lua+busted' \
--globals '_KONG' \
--globals 'ngx' \
--globals 'kong' \
--globals 'assert' \
--no-redefined \
--no-unused-args
install:
luarocks make $(PLUGIN_NAME)-*.rockspec
uninstall:
luarocks remove $(PLUGIN_NAME)-*.rockspec
install-dev:
luarocks make --tree lua_modules $(PLUGIN_NAME)-*.rockspec
test: install-dev
$(call set_env) \
$(TEST_CMD) $(current_dir)spec/01-unit
test-integration: install-dev
$(call set_env) \
$(TEST_CMD) $(current_dir)spec/02-integration
test-all: install-dev
$(call set_env) \
$(TEST_CMD) $(current_dir)spec/
clean:
@echo "removing $(PLUGIN_NAME)"
-@luarocks remove --tree lua_modules $(PLUGIN_NAME)-*.rockspec >/dev/null 2>&1 ||: