MODULE_NAME := $(notdir $(shell pwd)) MODULE_DIR := modules/$(MODULE_NAME) COFFEE := ../../node_modules/.bin/coffee BABEL := ../../node_modules/.bin/babel APP_COFFEE_FILES := $(shell [ -e app/coffee ] && find app/coffee -name '*.coffee') \ $(shell [ -e test/unit/coffee ] && find test/unit/coffee -name '*.coffee') \ $(shell [ -e test/acceptance/coffee ] && find test/acceptance/coffee -name '*.coffee') APP_JS_FILES := $(subst coffee,js,$(APP_COFFEE_FILES)) IDE_SRC_FILES := $(shell [ -e public/src/ide ] && find public/src/ide -name '*.js') IDE_OUTPUT_FILES := $(subst public/src/ide,../../public/js/ide/$(MODULE_NAME),$(IDE_SRC_FILES)) IDE_TEST_SRC_FILES := $(shell [ -e test/unit_frontend/src/ide ] && find test/unit_frontend/src/ide -name '*.js') IDE_TEST_OUTPUT_FILES := $(subst test/unit_frontend/src/ide,../../test/unit_frontend/js/ide/$(MODULE_NAME),$(IDE_TEST_SRC_FILES)) MAIN_SRC_FILES := $(shell [ -e public/src/main ] && find public/src/main -name '*.js') MAIN_OUTPUT_FILES := $(subst public/src/main,../../public/js/main/$(MODULE_NAME),$(MAIN_SRC_FILES)) DOCKER_COMPOSE_FLAGS := -f $(MODULE_DIR)/docker-compose.yml DOCKER_COMPOSE := cd ../../ && MODULE_DIR=$(MODULE_DIR) docker-compose -f docker-compose.yml ${DOCKER_COMPOSE_FLAGS} app/js/%.js: app/coffee/%.coffee @mkdir -p $(dir $@) $(COFFEE) --compile --print $< > $@ test/unit/js/%.js: test/unit/coffee/%.coffee @mkdir -p $(dir $@) $(COFFEE) --compile --print $< > $@ test/acceptance/js/%.js: test/acceptance/coffee/%.coffee @mkdir -p $(dir $@) $(COFFEE) --compile --print $< > $@ ../../test/unit_frontend/js/ide/$(MODULE_NAME)/%.js: test/unit_frontend/src/ide/%.js @mkdir -p $(dir $@) $(BABEL) $< --out-file $@ ../../public/js/ide/$(MODULE_NAME)/%.js: public/src/ide/%.js @mkdir -p $(dir $@) $(BABEL) $< --out-file $@ ../../public/js/main/$(MODULE_NAME)/%.js: public/src/main/%.js @mkdir -p $(dir $@) $(BABEL) $< --out-file $@ index.js: index.coffee $(COFFEE) --compile --print $< > $@ compile: $(APP_JS_FILES) $(IDE_OUTPUT_FILES) $(MAIN_OUTPUT_FILES) $(IDE_TEST_OUTPUT_FILES) index.js @echo > /dev/null compile_full: if [ -e app/coffee ]; then $(COFFEE) -o app/js -c app/coffee; fi if [ -e test/unit/coffee ]; then $(COFFEE) -o test/unit/js -c test/unit/coffee; fi if [ -e test/acceptance/coffee ]; then $(COFFEE) -o test/acceptance/js -c test/acceptance/coffee; fi if [ -e public/src/ide ]; then $(BABEL) public/src/ide --out-dir ../../public/js/ide/$(MODULE_NAME); fi if [ -e public/src/main ]; then $(BABEL) public/src/main --out-dir ../../public/js/main/$(MODULE_NAME); fi if [ -e test/unit_frontend/src/ide ]; then $(BABEL) test/unit_frontend/src/ide --out-dir ../../test/unit_frontend/js/ide/$(MODULE_NAME); fi @$(MAKE) compile test_acceptance: test_acceptance_start_service test_acceptance_run $(MAKE) test_acceptance_stop_service test_acceptance_start_service: test_acceptance_stop_service $(DOCKER_COMPOSE) up -d test_acceptance test_acceptance_stop_service: $(DOCKER_COMPOSE) stop -t 0 test_acceptance redis mongo test_acceptance_run: $(DOCKER_COMPOSE) exec -T test_acceptance npm -q run test:acceptance:dir -- ${MOCHA_ARGS} $(MODULE_DIR)/test/acceptance/js