|
1 | 1 | BIN = node_modules/.bin |
2 | 2 | DUO = $(BIN)/duo |
3 | | -MINIFY = $(BIN)/uglifyjs |
4 | | -WATCH = $(BIN)/wr |
5 | | -DELEGATE = test test-browser test-sauce test-coverage |
| 3 | +T = $(BIN)/duo-test -m test/api.js -R spec -P 8378 |
6 | 4 |
|
7 | | -BUILD = ./build |
8 | | -WATCH_FILES = lib index.js component.json Makefile |
| 5 | +SRC = index.js $(shell find lib -type f -name '*.js') |
| 6 | +TESTS = $(wildcard test/*.test.js) |
9 | 7 |
|
10 | | -build: node_modules |
11 | | - @mkdir -p $(BUILD) |
12 | | - @$(DUO) --quiet --stdout --global recurly index.js > $(BUILD)/recurly.js |
13 | | - @$(MINIFY) $(BUILD)/recurly.js --output $(BUILD)/recurly.min.js |
| 8 | +test: test-phantomjs |
| 9 | + |
| 10 | +test-phantomjs: build/recurly.min.js build/test.js |
| 11 | + @$(T) phantomjs |
| 12 | + |
| 13 | +test-browser: build/recurly.min.js build/test.js |
| 14 | + @$(T) browser |
| 15 | + |
| 16 | +test-sauce: BROWSER ?= ie:9 |
| 17 | +test-sauce: build/recurly.min.js build/test.js |
| 18 | + @$(T) saucelabs -b $(BROWSER) |
| 19 | + |
| 20 | +build: build/recurly.min.js |
| 21 | + |
| 22 | +build/recurly.js: index.js $(SRC) node_modules component.json |
| 23 | + @mkdir -p $(@D) |
| 24 | + @$(DUO) --quiet --stdout --global recurly < $< > $@ |
| 25 | + |
| 26 | +build/recurly.min.js: build/recurly.js |
| 27 | + @$(BIN)/uglifyjs $< --output $@ |
| 28 | + |
| 29 | +build/test.js: TESTFILE = $(foreach test, $(TESTS), 'require("./$(test)");') |
| 30 | +build/test.js: $(TESTS) |
| 31 | + @echo $(TESTFILE) | $(DUO) --quiet --development --type js --stdout > $@ |
14 | 32 |
|
15 | 33 | watch: node_modules |
16 | | - @$(WATCH) make $(WATCH_FILES) |
| 34 | + @$(BIN)/wr $(MAKE) component.json $(SRC) |
17 | 35 |
|
18 | 36 | node_modules: package.json |
19 | 37 | @npm install --silent |
20 | 38 |
|
21 | | -$(DELEGATE): build |
22 | | - @cd test && make $@ |
23 | | - |
24 | 39 | clean: |
25 | | - @rm -rf node_modules components/duo.json $(BUILD) |
26 | | - @cd test && make $@ |
| 40 | + @rm -rf node_modules components/duo.json build |
27 | 41 |
|
28 | | -.PHONY: clean build test test-browser test-sauce test-coverage |
| 42 | +.PHONY: test watch clean |
0 commit comments