Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/v0.17 #7

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ $ find . -type f
./conf/app.conf
./conf/routes

$ heroku create -b https://github.com/robfig/heroku-buildpack-go-revel.git
$ heroku create -b https://github.com/revel/heroku-buildpack-go-revel.git
...
```

Expand Down Expand Up @@ -62,6 +62,22 @@ $ git push heroku master
The buildpack will detect your repository as Revel if it
contains the `conf/app.conf` and `conf/routes` files.

It's possible to specify the revel mode by setting the REVEL_MODE environment variable. "prod" will be the default mode.

#### Dependencies and private repositories
If you want to use private repositories you just need to create Godeps folder with this command:
```
$ godep save ./...
```
and commit your changes:
```
$ git add -A .
$ git commit -a -m "Dependencies"
```
Once the `Godeps` created and committed you can push your changes (deploy):
```
$ git push heroku master
```
## Hacking on this Buildpack

To change this buildpack, fork it on GitHub. Push
Expand Down
122 changes: 94 additions & 28 deletions bin/compile
Original file line number Diff line number Diff line change
@@ -1,14 +1,43 @@
#!/bin/bash
# usage: bin/compile <build-dir> <cache-dir>
# usage: bin/compile <build-dir> <cache-dir> <env-dir>

set -eo pipefail

# Go releases for Darwin beginning with 1.2rc1
# have included more than one build, depending
# on the specific version of Mac OS X. Try to
# account for that, but don't try too hard.
# This doesn't affect Heroku builds, it's only
# for testing on Darwin systems.
platext() {
case $1 in
go1.0*|go1.1beta*|go1.1rc*|go1.1|go1.1.*) return ;;
esac
case $(uname|tr A-Z a-z) in
darwin) printf %s -osx10.8 ;;
esac
}

# Go releases have moved to a new URL scheme
# starting with Go version 1.2.2. Return the old
# location for known old versions and the new
# location otherwise.
urlfor() {
ver=$1
file=$2
case $ver in
go1.0*|go1.1beta*|go1.1rc*|go1.1|go1.1.*|go1.2beta*|go1.2rc*|go1.2|go1.2.1)
echo http://go.googlecode.com/files/$file
;;
*)
echo https://storage.googleapis.com/golang/$file
;;
esac
}

mkdir -p "$1" "$2"
build=$(cd "$1/" && pwd)
cache=$(cd "$2/" && pwd)
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
Expand All @@ -23,47 +52,60 @@ python=python2.7
PATH=$buildpack/$plat/bin:$venv/bin:$PATH

virtualenv() {
python "$buildpack/vendor/virtualenv-1.7/virtualenv.py" "$@"
python "$buildpack/vendor/virtualenv-1.11.6/virtualenv.py" "$@"
}

if test -f $build/Godeps
then name=$(<$build/Godeps jq -r .ImportPath)
then
name=$(<$build/Godeps jq -r .ImportPath)
ver=$(<$build/Godeps jq -r .GoVersion)
elif test -d $build/Godeps
then
name=$(<$build/Godeps/Godeps.json jq -r .ImportPath)
ver=$(<$build/Godeps/Godeps.json jq -r .GoVersion)
elif test -f $build/.godir
then name=$(cat $build/.godir)
then
name=$(cat $build/.godir)
ver=go${GOVERSION:-1.4}
else
echo >&2 " ! A .godir is required. For instructions:"
echo >&2 " ! http://mmcgrana.github.io/2012/09/getting-started-with-go-on-heroku"
exit 1
fi

file=${GOFILE:-$ver.$(uname|tr A-Z a-z)-amd64$(platext $ver).tar.gz}
url=${GOURL:-$(urlfor $ver $file)}

if test -e $build/bin && ! test -d $build/bin
then
echo >&2 " ! File bin exists and is not a directory."
exit 1
fi

if test -d $cache/go-$ver/go
if test -d $cache/$ver/go
then
echo "-----> Using Go $ver"
echo "-----> Using $ver"
else
rm -rf $cache/* # be sure not to build up cruft
mkdir -p $cache/go-$ver
cd $cache/go-$ver
echo -n "-----> Installing Go $ver..."
mkdir -p $cache/$ver
cd $cache/$ver
echo -n "-----> Installing $ver..."
curl -sO $url
tar zxf $file
rm -f $file
echo " done"
fi

cp -R $cache/go-$ver/go $build/.goroot
mkdir -p $build/bin
cp -R $cache/$ver/go $build/.goroot

GOBIN=$build/bin export GOBIN
GOROOT=$build/.goroot export GOROOT
GOPATH=$build/.go export GOPATH
PATH=$GOPATH/bin:$GOROOT/bin:$PATH
PATH=$GOROOT/bin:$PATH


if ! (which hg > /dev/null && which bzr > /dev/null)
if ! (which hg >/dev/null && which bzr >/dev/null)
then
echo -n " Installing Virtualenv..."
virtualenv --python $python --distribute --never-download --prompt='(venv) ' $venv > /dev/null 2>&1
Expand All @@ -83,26 +125,50 @@ p=$GOPATH/src/$name
mkdir -p $p
cp -R $build/* $p

unset GIT_DIR # unset git dir or it will mess with goinstall
cd $p
if test -f $build/Godeps
# allow apps to specify cgo flags and set up /app symlink so things like CGO_CFLAGS=-I/app/... work
env_dir="$3"
if [ -d "$env_dir" ]
then
echo "-----> Running: godep go get -tags heroku ./..."
godep go get -tags heroku ./...
else
echo "-----> Running: go get -tags heroku ./..."
go get -tags heroku ./...
ln -sfn $build /app/code
for cgo_opt in CGO_CFLAGS CGO_CPPFLAGS CGO_CXXFLAGS CGO_LDFLAGS
do
if [ -f "$env_dir/$cgo_opt" ]
then
export "$cgo_opt=$(cat "$env_dir/$cgo_opt")"
fi
done
fi

mkdir -p $build/bin
if test -d $GOPATH/bin
FLAGS=(-tags heroku)
if test -f "$env_dir/GO_GIT_DESCRIBE_SYMBOL"
then
git_describe=$(git describe --tags --always)
git_describe_symbol=$(cat "$env_dir/GO_GIT_DESCRIBE_SYMBOL")
FLAGS=(${FLAGS[@]} -ldflags "-X $git_describe_symbol $git_describe")
fi

unset GIT_DIR # unset git dir or it will mess with goinstall
cd $p
if test -e $build/Godeps
then
mv $GOPATH/bin/* $build/bin
if test -d $build/vendor
then
# go1.6+ or GO15VENDOREXPERIMENT
echo "-----> Running: godep restore"
godep restore
else
echo "-----> Copying workspace"
cp -R $(godep path)/* $GOPATH
echo "-----> Running: godep go install ${FLAGS[@]} ./..."
godep go install "${FLAGS[@]}" ./...
fi
else
echo "-----> Running: go get ${FLAGS[@]} ./..."
go get "${FLAGS[@]}" ./...
fi

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
go get github.com/revel/cmd/revel
11 changes: 8 additions & 3 deletions bin/release
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@
# bin/release <build-dir>

name=$(cat $1/.godir)

# Get the Revel mode from the REVEL_MODE environment variable (defaults to "prod")
env=$REVEL_MODE
if [ -z "$env" ]; then
env="prod"
fi

cat <<EOF
---
config_vars:
PATH: /app/bin:/app/.go/bin:/app/.goroot/bin:/usr/local/bin:/usr/bin:/bin
GOROOT: /app/.goroot
GOPATH: /app/.go
default_process_types:
web: revel run $name prod \$PORT
web: revel run $name $env \$PORT
EOF


Binary file modified linux-amd64/bin/godep
Binary file not shown.
91 changes: 91 additions & 0 deletions vendor/virtualenv-1.11.6/AUTHORS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
Author
------

Ian Bicking

Maintainers
-----------

Brian Rosner
Carl Meyer
Jannis Leidel
Paul Moore
Paul Nasrat
Marcus Smith

Contributors
------------

Alex Grönholm
Anatoly Techtonik
Antonio Cuni
Antonio Valentino
Armin Ronacher
Barry Warsaw
Benjamin Root
Bradley Ayers
Branden Rolston
Brandon Carl
Brian Kearns
Cap Petschulat
CBWhiz
Chris Adams
Chris McDonough
Christos Kontas
Christian Hudon
Christian Stefanescu
Christopher Nilsson
Cliff Xuan
Curt Micol
Damien Nozay
Dan Sully
Daniel Hahler
Daniel Holth
David Schoonover
Denis Costa
Doug Hellmann
Doug Napoleone
Douglas Creager
Eduard-Cristian Stefan
Erik M. Bray
Ethan Jucovy
Gabriel de Perthuis
Gunnlaugur Thor Briem
Graham Dennis
Greg Haskins
Jason Penney
Jason R. Coombs
Jeff Hammel
Jeremy Orem
Jason Penney
Jason R. Coombs
John Kleint
Jonathan Griffin
Jonathan Hitchcock
Jorge Vargas
Josh Bronson
Kamil Kisiel
Kyle Gibson
Konstantin Zemlyak
Kumar McMillan
Lars Francke
Marc Abramowitz
Mika Laitio
Mike Hommey
Miki Tebeka
Philip Jenvey
Philippe Ombredanne
Piotr Dobrogost
Preston Holmes
Ralf Schmitt
Raul Leal
Ronny Pfannschmidt
Satrajit Ghosh
Sergio de Carvalho
Stefano Rivera
Tarek Ziadé
Thomas Aglassinger
Vinay Sajip
Vitaly Babiy
Vladimir Rutsky
Wang Xuerui
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Copyright (c) 2007 Ian Bicking and Contributors
Copyright (c) 2009 Ian Bicking, The Open Planning Project
Copyright (c) 2011 The virtualenv developers
Copyright (c) 2011-2014 The virtualenv developers

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
11 changes: 11 additions & 0 deletions vendor/virtualenv-1.11.6/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
recursive-include bin *
recursive-include docs *
recursive-include scripts *
recursive-include virtualenv_support *.whl
recursive-include virtualenv_embedded *
recursive-exclude docs/_templates *
recursive-exclude docs/_build *
include virtualenv_support/__init__.py
include *.py
include AUTHORS.txt
include LICENSE.txt
Loading