]> git.cworth.org Git - turbot/blobdiff - Makefile
Share the rot() implementation between both Lambda and Flask implementations
[turbot] / Makefile
index d0719d8cdb82fdf9ef6ace038f5a4fca019a4b45..640c8f0ca4316c74b771d3a6148f7054e6908e75 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ DEPLOY_HOST=halibut.cworth.org
 DEPLOY_DIR=/srv/halibut.cworth.org/turbot
 export DEPLOY_DIR
 DO_NOT_DEPLOY=env .gitignore
-DO_NOT_DELETE=.turbot.env
+DO_NOT_DELETE=.slack-creds.env .gsheets-creds.json .gsheets-token.pickle
 
 help:
        @echo "Available targets (in rough order of expected use):"
@@ -57,16 +57,33 @@ run: require-venv
 turbot.wsgi: turbot.wsgi.in Makefile
        envsubst < turbot.wsgi.in > turbot.wsgi
 
-deploy:
-       rm -rf .deploy-source
-       git clone . .deploy-source
-       rm -rf .deploy-source/.git
-       make -C .deploy-source turbot.wsgi
-       (cd .deploy-source; rsync -avz \
+.PHONY: deploy-flask
+deploy-flask:
+       rm -rf .deploy-flask-source
+       git clone . .deploy-flask-source
+       rm -rf .deploy-flask-source/.git
+       make -C .deploy-flask-source turbot.wsgi
+       (cd .deploy-flask-source; rsync -avz \
                $(DO_NOT_DEPLOY:%=--exclude=%) \
-               --exclude=$(DO_NOT_DELETE) \
+               $(patsubst %,--exclude %,$(DO_NOT_DELETE)) \
                --delete \
                --delete-after \
                ./ $(DEPLOY_HOST):$(DEPLOY_DIR) )
-       rm -rf .deploy-source
+       rm -rf .deploy-flask-source
        ssh $(DEPLOY_HOST) '(cd $(DEPLOY_DIR); make bootstrap; . env/bin/activate; make reqs)'
+
+.PHONY: deploy-lambda
+deploy-lambda:
+       rm -rf .deploy-lambda-source
+       git clone . .deploy-lambda-source
+       (cd .deploy-lambda-source/turbot_lambda; zip ../turbot.zip lambda_function.py)
+       (cd .deploy-lambda-source; zip turbot.zip $$(git ls-files -- turbot))
+       (cd .deploy-lambda-source; \
+               aws lambda update-function-code \
+               --profile halibut \
+               --function-name turbot \
+               --zip-file fileb://turbot.zip )
+       rm -rf .deploy-lambda-source
+
+.PHONY: deploy
+deploy: deploy-flask deploy-lambda