Add option to allow deploy with unclean working state. Add
customisation for connection settings.
--- a/Makefile Sun Jan 10 17:04:04 2016 +0200
+++ b/Makefile Sat Feb 06 14:34:51 2016 +0200
@@ -1,7 +1,15 @@
#
# You can override such variables in Makefile.config:
#
-# SF_USER SourceForge user name.
+# FORCE Non empty allow deploy with unclean working state.
+#
+# SF_USER SourceForge user name.
+# WWW_SRV_NAME
+# WWW_SRV_USER
+# WWW_SRV_DIR
+# HG_SRV_NAME
+# HG_SRV_USER
+# HG_SRV_DIR
################################################################
# Standard GNU Makefile settings.
@@ -120,12 +128,14 @@
################################################################
# Deploy targets.
-ifeq '' '$(SF_USER)'
- SF_USER := gavenkoa
-endif
-ifeq '' '$(DEFUN_USER)'
- DEFUN_USER := user
-endif
+SF_USER ?= gavenkoa
+
+WWW_SRV_NAME ?= defun.work
+WWW_SRV_USER ?= user
+WWW_SRV_DIR ?= /srv/www/2048
+HG_SRV_NAME ?= hg.defun.work
+HG_SRV_USER ?= user
+HG_SRV_DIR ?= /srv/hg/2048-js-ai
.PHONY: deploy
deploy: deploy2defun deploy2sf
@@ -135,18 +145,18 @@
.PHONY: deploy2defun-src
deploy2defun-src:
- hg push ssh://$(DEFUN_USER)@hg.defun.work//srv/hg/2048-js-ai/ || [ $$? = 1 ]
+ hg push ssh://$(HG_SRV_USER)@$(HG_SRV_NAME)/$(HG_SRV_DIR)/ || [ $$? = 1 ]
.PHONY: deploy2defun-www
deploy2defun-www: deploy-check $(WWW_FILES)
- ( echo 'cd /srv/www/2048'; \
+ ( echo 'cd $(WWW_SRV_DIR)'; \
for f in $(WWW_FILES); do \
echo "put $$f"; \
echo "chmod 644 $$f"; \
done; \
echo "put 2048.html index.html"; \
echo 'quit'; \
-) | sftp -b - $(DEFUN_USER)@defun.work
+) | sftp -b - $(WWW_SRV_USER)@$(WWW_SRV_NAME)
# First time you deploy to SourceForge (sf) you need manually login to:
# $ sftp $(SF_USER),$(pkgname)@web.sourceforge.net
@@ -189,12 +199,12 @@
.PHONY: deploy-check
deploy-check:
\
-case ${visclean} in \
+case "$(FORCE)$(visclean)" in \
no) echo "Local changes found. Build stop."; \
exit 1;; \
esac
\
-case $(vatrelease) in \
+case "$(FORCE)$(vatrelease)" in \
no) echo "We are not at release. Build stop."; \
exit 1;; \
esac