diff --git a/AUTHORS b/AUTHORS index c61e1098f..3b247d885 100644 --- a/AUTHORS +++ b/AUTHORS @@ -8,6 +8,7 @@ Felipe Coury Jeff Lindsay Jose Diaz-Gonzalez Leo Unbekandt +Ludovic Perrine Luigi Maselli Martin Weiss Paul Lietar diff --git a/HISTORY.md b/HISTORY.md index ecc00a5de..085f7977f 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -2,6 +2,8 @@ ## 0.3.0 (in progress) +* Added git submodules support + ## 0.2.0 (2013-11-24) * Added DOKKU_TRACE variable for verbose trace information diff --git a/plugins/git/commands b/plugins/git/commands index b7b1cb2c2..31e606670 100755 --- a/plugins/git/commands +++ b/plugins/git/commands @@ -1,6 +1,21 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +git_archive_all() { + APP=$1; REV=$2 + TMP_WORK_DIR=$(mktemp -d) + chmod 755 $TMP_WORK_DIR + unset GIT_DIR GIT_WORK_TREE + git clone $DOKKU_ROOT/$APP $TMP_WORK_DIR > /dev/null + pushd $TMP_WORK_DIR > /dev/null + git checkout $REV > /dev/null + git submodule update --init --recursive > /dev/null + find -name .git -prune -exec rm -rf {} \; > /dev/null + tar c . + popd > /dev/null + rm -rf $TMP_WORK_DIR > /dev/null +} + case "$1" in git-hook) APP=$2 @@ -10,7 +25,7 @@ case "$1" in # 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 - git archive $newrev | dokku receive $APP | sed -u "s/^/"$'\e[1G'"/" + git_archive_all $APP $newrev | dokku receive $APP | sed -u "s/^/"$'\e[1G'"/" 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'" diff --git a/tests/apps/gitsubmodules/Procfile b/tests/apps/gitsubmodules/Procfile new file mode 100644 index 000000000..b0916e51c --- /dev/null +++ b/tests/apps/gitsubmodules/Procfile @@ -0,0 +1 @@ +web: bin/node node-js-sample/web.js diff --git a/tests/apps/gitsubmodules/check_deploy b/tests/apps/gitsubmodules/check_deploy new file mode 100755 index 000000000..2fdc00cf6 --- /dev/null +++ b/tests/apps/gitsubmodules/check_deploy @@ -0,0 +1,2 @@ +#!/bin/bash +set -e; output="$(curl -s $1)"; echo $output; test "$output" == "Hello World!" \ No newline at end of file diff --git a/tests/apps/gitsubmodules/package.json b/tests/apps/gitsubmodules/package.json new file mode 100644 index 000000000..742e06105 --- /dev/null +++ b/tests/apps/gitsubmodules/package.json @@ -0,0 +1,11 @@ +{ + "name": "node-example", + "version": "0.0.1", + "dependencies": { + "express": "~3.3.4" + }, + "engines": { + "node": "0.10.x", + "npm": "1.3.x" + } +} \ No newline at end of file diff --git a/tests/apps/gitsubmodules/pre-commit b/tests/apps/gitsubmodules/pre-commit new file mode 100755 index 000000000..d0cd805b2 --- /dev/null +++ b/tests/apps/gitsubmodules/pre-commit @@ -0,0 +1,2 @@ +#!/bin/bash +git submodule add https://github.com/heroku/node-js-sample.git node-js-sample