diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2013-04-29 11:05:09 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2014-03-12 17:28:59 -0600 |
commit | d33715066aab8bace17bb575a1787af40f86e67a (patch) | |
tree | 2b315dbdd7839a93b344a68cc1e4c23e4902ccb8 /web/Makefile | |
parent | Add semi-colon. (diff) | |
download | PhotoFloat-d33715066aab8bace17bb575a1787af40f86e67a.tar.xz PhotoFloat-d33715066aab8bace17bb575a1787af40f86e67a.zip |
Restructuring
Import flask app as well as new makefile and entirely new directory
structure.
Diffstat (limited to 'web/Makefile')
-rw-r--r-- | web/Makefile | 57 |
1 files changed, 42 insertions, 15 deletions
diff --git a/web/Makefile b/web/Makefile index dd112e9..fc9e181 100644 --- a/web/Makefile +++ b/web/Makefile @@ -7,36 +7,63 @@ CSS_MIN = $(CSS_DIR)/styles.min.css JS_MIN_FILES := $(sort $(patsubst %.js, %.min.js, $(filter-out %.min.js, $(wildcard $(JS_DIR)/*.js)))) CSS_MIN_FILES := $(sort $(patsubst %.css, %.min.css, $(filter-out %.min.css, $(wildcard $(CSS_DIR)/*.css)))) -JS_COMPILER = utils/google-compiler --warning_level QUIET -CSS_COMPILER = utils/yuicompressor --type css +JS_COMPILER := java -jar bin/closure-compiler.jar --warning_level QUIET +CSS_COMPILER := java -jar bin/yui-compressor.jar --type css -.PHONY: all clean +DEBUG ?= 0 -all: $(JS_MIN) $(CSS_MIN) utils/ServerExecute.class +.PHONY: all deploy clean +all: $(JS_MIN) $(CSS_MIN) + +ifeq ($(DEBUG),0) %.min.js: %.js - @echo "Compiling javascript" $< + @echo " JS " $@ @$(JS_COMPILER) --js $< --js_output_file $@ +else +%.min.js: %.js + @echo " JS " $@ + @cat $< > $@ +endif %.min.css: %.css - @echo "Compiling stylesheet" $< + @echo " CSS " $@ @$(CSS_COMPILER) -o $@ $< $(JS_MIN): $(JS_MIN_FILES) - @echo "Assembling compiled javascripts" + @echo " CAT " $@ @cat $^ > $@ $(CSS_MIN): $(CSS_MIN_FILES) - @echo "Assembling compiled stylesheets" + @echo " CAT " $@ @cat $^ > $@ -empty := -space := $(empty) $(empty) -classpath := $(subst $(space),:,$(wildcard utils/htmlunit-2.8/*.jar)) -utils/ServerExecute.class: utils/ServerExecute.java - @echo "Building HtmlUnit wrapper." - @javac -classpath $(classpath) -d utils $^ - clean: + @echo " RM " $(JS_MIN) $(JS_MIN_FILES) $(CSS_MIN) $(CSS_MIN_FILES) @rm -fv $(JS_MIN) $(JS_MIN_FILES) $(CSS_MIN) $(CSS_MIN_FILES) +include ../deployment-config.mk + +SSH_OPTS := -q -o ControlMaster=auto -o ControlPath=.ssh-deployment.sock + +deploy: all + @echo " SSH $(WEB_SERVER)" + @ssh $(SSH_OPTS) -Nf $(WEB_SERVER) + + @echo " RSYNC . $(WEB_SERVER):$(HTDOCS_PATH)" + @ssh -t $(SSH_OPTS) $(WEB_SERVER) "sudo -u $(HTDOCS_USER) -v" + @rsync -aizm --delete-excluded --exclude=.ssh-deployment.sock --exclude=Makefile --exclude=*.swp \ + --exclude=bin/ --include=scripts.min.js --include=styles.min.css \ + --exclude=*.js --exclude=*.css --rsh="ssh $(SSH_OPTS)" \ + --rsync-path="sudo -n -u $(HTDOCS_USER) rsync" \ + . "$(WEB_SERVER):$(HTDOCS_PATH)" + + @echo " CHOWN $(HTDOCS_USER):$(HTDOCS_USER) $(WEB_SERVER):$(HTDOCS_PATH)" + @ssh -t $(SSH_OPTS) $(WEB_SERVER) "sudo chown -R $(HTDOCS_USER):$(HTDOCS_USER) '$(HTDOCS_PATH)'" + + @echo " CHMOD 750/640 $(WEB_SERVER):$(HTDOCS_PATH)" + @ssh -t $(SSH_OPTS) $(WEB_SERVER) "sudo find '$(HTDOCS_PATH)' -type f -exec chmod 640 {} \;; \ + sudo find '$(HTDOCS_PATH)' -type d -exec chmod 750 {} \;;" + + @echo " SSH $(WEB_SERVER)" + @ssh -O exit $(SSH_OPTS) $(WEB_SERVER) |