#!/usr/bin/env bash source "$(dirname $0)/../dokku_common" create_pre_receive_hook() { PRERECEIVE_HOOK="$2/hooks/pre-receive" cat > "$PRERECEIVE_HOOK" < /dev/null create_pre_receive_hook "$@" } case "$1" in git-hook) verify_app_name "$2" # if we got here we have full access export NAME="dokku" export FINGERPRINT="" while read oldrev newrev refname do # Only run this script for the master branch. You can remove this # if block if you wish to run it for others as well. if [[ $refname = "refs/heads/master" ]] ; then dokku rebuild "$APP" "$newrev" else echo $'\e[1G\e[K'"-----> WARNING: deploy did not complete, you must push to master." echo $'\e[1G\e[K'"-----> for example, try 'git push ${refname/refs\/heads\/}:master'" fi done ;; git-upload-pack) APP="$(echo $2 | perl -pe 's/(? "refs/heads/master" trap - EXIT ;; help | git:help) cat && cat < Create shallow app clone [branch] Create application by cloning git repository EOF ;; *) exit $DOKKU_NOT_IMPLEMENTED_EXIT ;; esac