diff --git a/README.md b/README.md new file mode 100644 index 0000000..c0d5e72 --- /dev/null +++ b/README.md @@ -0,0 +1,35 @@ +# Heroku buildpack: Vert.x + +This is a [Heroku buildpack](http://devcenter.heroku.com/articles/buildpack) for [Vert.X](http://vertx.io/) apps. + +Currently it uses following versions: + +* JDK **1.7** +* vert.x **2.0.2-final** + +## Usage + +This buildpack assumes that there are at least two files in repository: + +* ```mod.json``` - used to determine if this is vert.x project +* ```server.js``` - by default file that will be launched (of course this can be overrided by Procfile) + +Example usage: + + $ ls + mod.json server.js + + $ heroku create --stack cedar --buildpack https://github.com/mthenw/heroku-buildpack-vertx.git + + $ git push heroku master + + -----> Heroku receiving push + -----> Fetching custom build pack... done + -----> Vert.x app detected + -----> Installing Vert.x..... done + +This buildpack is based on [tomaslin/heroku-buildpack-vertx-jdk7](https://github.com/tomaslin/heroku-buildpack-vertx-jdk7). + +## License + +MIT \ No newline at end of file diff --git a/bin/compile b/bin/compile new file mode 100755 index 0000000..f982282 --- /dev/null +++ b/bin/compile @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +# bin/compile + +# fail fast +set -e + +OPENJDK7_URL="https://s3.amazonaws.com/heroku-jvm-langpack-java/openjdk7-u2-heroku-temaki.tar.gz" +VERTX_URL="http://dl.bintray.com/vertx/downloads/vert.x-2.0.2-final.tar.gz" + +BIN_DIR=$(cd $(dirname $0); pwd) # absolute path +# parse args +BUILD_DIR=$1 +CACHE_DIR=$2 + +#create the cache dir if it doesn't exist +mkdir -p $CACHE_DIR + +cd $BUILD_DIR +if [ -d "$CACHE_DIR/.jdk7" ]; then + echo -n "Copying JDK to app directory" + cp -r "$CACHE_DIR/.jdk7" $BUILD_DIR + echo "done" +fi + +if [ ! -d "$BUILD_DIR/.jdk7" ]; then + echo -n "-----> Installing OpenJDK7u2 build (to .jdk7)....." + mkdir "$BUILD_DIR/.jdk7" + cd "$BUILD_DIR/.jdk7" + curl --max-time 180 --location $OPENJDK7_URL | tar xz + cd $BUILD_DIR + cp -r .jdk7 $CACHE_DIR/.jdk7 + echo " done" +fi + +if [ -d "$CACHE_DIR/.vertx" ]; then + echo -n "Copying Vert.x to app direcotry" + cp -r "$CACHE_DIR/.vertx" $BUILD_DIR + echo " done" +fi + +if [ ! -d "$BUILD_DIR/.vertx" ]; then + echo -n "-----> Installing Vert.x build (to .vertx)....." + curl --max-time 320 --location $VERTX_URL | tar xz + mv vert* .vertx + rm '.vertx/bin/vertx.bat' + cd $BUILD_DIR + cp -r .vertx $CACHE_DIR/.vertx + echo " done" +fi + +cd $BUILD_DIR + +export JAVA_HOME="$BUILD_DIR/.jdk7" +export VERTX_HOME="$BUILD_DIR/.vertx" +export PATH=$PATH:$JAVA_HOME/bin:$VERTX_HOME/bin + +echo "Path is set to" +echo $PATH + +if [ -f compile.sh ]; then + echo 'compile.sh file found, executing...' + chmod 700 compile.sh + ./compile.sh +fi + +# Warn if no Procfile is present +if [ ! -f Procfile ]; then + echo "-----> No Procfile found. Will use the following default process: " + echo " vertx run server.js" +fi diff --git a/bin/detect b/bin/detect new file mode 100755 index 0000000..bd05027 --- /dev/null +++ b/bin/detect @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# bin/use + +if [ -f $1/mod.json ]; then + echo "Vert.x" && exit 0 +else + echo "no" && exit 1 +fi \ No newline at end of file diff --git a/bin/release b/bin/release new file mode 100755 index 0000000..0cc7638 --- /dev/null +++ b/bin/release @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# bin/release + +BUILD_DIR=$1 + +cat <