diff --git a/bin/compile b/bin/compile index 1a9fb263..660547a2 100755 --- a/bin/compile +++ b/bin/compile @@ -6,25 +6,33 @@ set -eo pipefail mkdir -p "$1" "$2" build=$(cd "$1/" && pwd) cache=$(cd "$2/" && pwd) -ver=${GOVERSION:-1.1} +ver=${GOVERSION:-1.1.2} file=${GOFILE:-go$ver.$(uname|tr A-Z a-z)-amd64.tar.gz} url=${GOURL:-http://go.googlecode.com/files/$file} buildpack=$(dirname $(dirname $0)) +arch=$(uname -m|tr A-Z a-z) +if test $arch = x86_64 +then arch=amd64 +fi +plat=$(uname|tr A-Z a-z)-$arch # Python venv=$cache/venv mkdir -p $cache/pip python=python2.7 -PATH=$venv/bin:$PATH +PATH=$buildpack/$plat/bin:$venv/bin:$PATH virtualenv() { python "$buildpack/vendor/virtualenv-1.7/virtualenv.py" "$@" } -if ! test -f $build/.godir -then +if test -f $build/Godeps +then name=$(<$build/Godeps jq -r .ImportPath) +elif test -f $build/.godir +then name=$(cat $build/.godir) +else echo >&2 " ! A .godir is required. For instructions:" - echo >&2 " ! http://mmcgrana.github.com/2012/09/getting-started-with-go-on-heroku" + echo >&2 " ! http://mmcgrana.github.io/2012/09/getting-started-with-go-on-heroku" exit 1 fi @@ -63,23 +71,34 @@ then echo " done" echo -n " Installing Mercurial..." - pip install --use-mirrors mercurial > /dev/null 2>&1 + pip install mercurial > /dev/null 2>&1 echo " done" echo -n " Installing Bazaar..." - pip install --use-mirrors bzr > /dev/null 2>&1 + pip install bzr > /dev/null 2>&1 echo " done" fi -name=$(cat $build/.godir) p=$GOPATH/src/$name mkdir -p $p cp -R $build/* $p unset GIT_DIR # unset git dir or it will mess with goinstall -echo "-----> Running: go get -tags heroku ./..." cd $p -go get -tags heroku ./... +if test -f $build/Godeps +then + echo "-----> Running: godep go get -tags heroku ./..." + godep go get -tags heroku ./... +else + echo "-----> Running: go get -tags heroku ./..." + go get -tags heroku ./... +fi mkdir -p $build/bin +mv $GOPATH/bin/* $build/bin +rm -rf $build/.heroku + +mkdir -p $build/.profile.d +echo 'PATH=$PATH:$HOME/bin' > $build/.profile.d/go.sh + go get github.com/robfig/revel/revel diff --git a/compile-test.sh b/compile-test.sh index 9004c677..3f562ab1 100644 --- a/compile-test.sh +++ b/compile-test.sh @@ -1,30 +1,30 @@ #!/bin/sh -ver=1.1 - before() { rm -rf build cache cp -r test build mkdir cache } -after() { - rm -rf build cache -} - compile() { - sh bin/compile build cache 2>&1 + pushd . + source bin/compile build cache 2>&1 + popd } it_installs_go() { + unset GOROOT compile - test -f cache/go-$ver/go/bin/go - test -x cache/go-$ver/go/bin/go + test -f $GOROOT/bin/go + test -x $GOROOT/bin/go + rm -rf build cache } it_skips_go_compile_if_exists() { - mkdir -p cache/go-$ver/go + GOVERSION=foo + mkdir -p cache/go-$GOVERSION/go compile | grep Using + rm -rf build cache } it_compiles_app() { @@ -32,4 +32,5 @@ it_compiles_app() { test -f build/bin/mytest test -x build/bin/mytest test "$(./build/bin/mytest 2>&1)" = "ok" -} + rm -rf build cache +} \ No newline at end of file diff --git a/linux-amd64/bin/godep b/linux-amd64/bin/godep new file mode 100755 index 00000000..e57f5e0f Binary files /dev/null and b/linux-amd64/bin/godep differ diff --git a/linux-amd64/bin/jq b/linux-amd64/bin/jq new file mode 100755 index 00000000..96241f76 Binary files /dev/null and b/linux-amd64/bin/jq differ