Navigation Menu

Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Conflicts:
	bin/compile
	compile-test.sh
  • Loading branch information
clipperhouse committed Oct 3, 2013
2 parents 67b9b38 + e19ae65 commit 38714f7
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 21 deletions.
39 changes: 29 additions & 10 deletions bin/compile
Expand Up @@ -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

Expand Down Expand Up @@ -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
23 changes: 12 additions & 11 deletions compile-test.sh
@@ -1,35 +1,36 @@
#!/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() {
compile
test -f build/bin/mytest
test -x build/bin/mytest
test "$(./build/bin/mytest 2>&1)" = "ok"
}
rm -rf build cache
}
Binary file added linux-amd64/bin/godep
Binary file not shown.
Binary file added linux-amd64/bin/jq
Binary file not shown.

0 comments on commit 38714f7

Please sign in to comment.