Reads various configuration variables from the env.
authordsc <dsc@wikimedia.org>
Mon, 9 Apr 2012 23:31:33 +0000 (16:31 -0700)
committerdsc <dsc@wikimedia.org>
Mon, 9 Apr 2012 23:31:33 +0000 (16:31 -0700)
deploy.sh

index 908e0bb..1c626e2 100755 (executable)
--- a/deploy.sh
+++ b/deploy.sh
@@ -7,13 +7,14 @@
 set -e
 
 
-VERBOSE=1
-DEPLOY_HOST=wmf@less.ly
-DEPLOY_PATH=projects/kraken-ui/
+VERBOSE='-v'
+KRAKEN_DEV_HOST="${KRAKEN_DEV_HOST:-localhost:8081}"
+KRAKEN_DEPLOY_HOST="${KRAKEN_DEPLOY_HOST:-wmf@less.ly}"
+KRAKEN_DEPLOY_PATH="${KRAKEN_DEPLOY_PATH:-projects/kraken-ui/}"
 
 
 # Utilities
-log () { [ "$VERBOSE" ] && echo -e "$*" >&2; }
+log () { [ "x$VERBOSE" != 'x' ] && echo -e "$*" >&2; }
 fail  () { echo >&2; echo "Error: $*" >&2; exit 1; }
 
 count () { echo $#; }
@@ -33,7 +34,7 @@ log "Collapsing serve trees..."
 rsync -Ca static/ var/ data tmp/dist/
 rsync -Ca lib/ tmp/dist/src/
 # browserify -o tmp/dist/vendor/browserify.js -r events -r seq
-curl --silent --fail --url http://localhost:8081/vendor/browserify.js > tmp/dist/vendor/browserify.js
+curl --silent --fail --url http://$KRAKEN_DEV_HOST/vendor/browserify.js > tmp/dist/vendor/browserify.js
 log "ok!"
 
 # Bundle Vendor JS Bundle
@@ -69,7 +70,8 @@ log "ok!"
 
 # Finally, deploy the files
 log "Deploying files..."
-rsync -Caz $([ "$VERBOSE" ] && echo '-v') --progress tmp/dist $DEPLOY_HOST:$DEPLOY_PATH
+log "rsync -Caz $VERBOSE --progress tmp/dist $KRAKEN_DEPLOY_HOST:$KRAKEN_DEPLOY_PATH"
+rsync -Caz $VERBOSE --progress tmp/dist $KRAKEN_DEPLOY_HOST:$KRAKEN_DEPLOY_PATH
 log "ok!"
 
 log "Done!"