Skip to content

Commit

Permalink
Merge pull request #1 from bbrowning/jruby-fix
Browse files Browse the repository at this point in the history
Move JRuby and bundle install to script/jruby instead of pom.xml
  • Loading branch information
joshk committed Nov 9, 2011
2 parents b016601 + dd307d9 commit 9d0abbe
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 57 deletions.
39 changes: 0 additions & 39 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,9 @@
<name>travis-hub-app</name>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-complete</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>org.jruby.plugins</groupId>
<artifactId>jruby-rake-plugin</artifactId>
<version>1.6.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jruby.plugins</groupId>
<artifactId>jruby-rake-plugin</artifactId>
<version>1.6.5</version>
<executions>
<execution>
<id>install-bundler</id>
<phase>process-resources</phase>
<goals>
<goal>jruby</goal>
</goals>
<configuration>
<args>-S gem install bundler --pre --no-ri --no-rdoc --install-dir .gems</args>
</configuration>
</execution>
<execution>
<id>bundle-install</id>
<phase>process-resources</phase>
<goals>
<goal>jruby</goal>
</goals>
<configuration>
<args>
-e ENV['GEM_HOME']=File.join(Dir.pwd,'.gems');ENV['GEM_PATH']=File.join(Dir.pwd,'.gems');ENV['BUNDLE_GEMFILE']=File.join(Dir.pwd,'Jemfile');require'rubygems';require'bundler';require'bundler/cli';cli=Bundler::CLI.new;cli.install;
</args>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
45 changes: 27 additions & 18 deletions script/jruby
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
#!/bin/sh

APPDIR=`pwd`
REPO="$APPDIR"/.m2/repository
JRUBY_VERSION="1.6.5"

export CLASSPATH=$CLASSPATH_PREFIX:$APPDIR/etc:$REPO/org/jruby/jruby-complete/1.6.5/jruby-complete-1.6.5.jar
export CLASSPATH=$CLASSPATH_PREFIX:$APPDIR/etc
export GEM_HOME=$APPDIR/vendor/bundle
export GEM_PATH=$APPDIR/.gems:$APPDIR/vendor/bundle
export PATH=$APPDIR/.gem/bin:$APPDIR/vendor/bundle/bin:$PATH
export PATH=$APPDIR/.gems/bin:$APPDIR/vendor/bundle/bin:$PATH
export BUNDLE_GEMFILE=$APPDIR/Jemfile
export JRUBY_OPTS=--1.9
#export JRUBY_OPTS=--1.9

# echo "APPDIR : $APPDIR"
# echo "REPO : $REPO"
# echo "CLASSPATH : $CLASSPATH"
# echo "GEM_PATH : $GEM_PATH"
# echo "PATH : $PATH"
# echo "bundler_env : $bundler_env"
# Download a JRuby if needed
if [ ! -d jruby-${JRUBY_VERSION} ]; then
curl -o jruby-bin-${JRUBY_VERSION}.tar.gz "http://jruby.org.s3.amazonaws.com/downloads/${JRUBY_VERSION}/jruby-bin-${JRUBY_VERSION}.tar.gz"
tar -xzf jruby-bin-${JRUBY_VERSION}.tar.gz
rm jruby-bin-${JRUBY_VERSION}.tar.gz
fi

# Add JRuby to the path
export PATH=${APPDIR}/jruby-${JRUBY_VERSION}/bin:$PATH

# Install Bundler if needed
if ! jruby -S gem list | grep bundler > /dev/null; then
jruby -S gem install bundler --pre --no-ri --no-rdoc --install-dir .gems
fi

# Install gems
bundle install --gemfile=Jemfile

max_mem=500m
max_stack=2048k
Expand All @@ -32,12 +43,10 @@ max_stack=2048k
# echo `env`
# echo `cat .bundle/config`

java $JAVA_OPTS \
-Dfile.encoding=UTF-8 -Xmx$max_mem -Xss$max_stack \
-Djruby.memory.max=$max_mem -Djruby.stack.max=$max_stack \
-Dsun.java.command=org.jruby.Main \
-Djruby.compat.version=1.9 \
-classpath "$CLASSPATH" \
-Dbasedir="$APPDIR" \
org.jruby.Main \
jruby \
-J-Dfile.encoding=UTF-8 -J-Xmx$max_mem -J-Xss$max_stack \
-J-Djruby.memory.max=$max_mem -J-Djruby.stack.max=$max_stack \
-J-Dsun.java.command=org.jruby.Main \
-J-classpath "$CLASSPATH" \
-J-Dbasedir="$APPDIR" \
"$@"

0 comments on commit 9d0abbe

Please sign in to comment.