Skip to content

Instantly share code, notes, and snippets.

@mikiobraun
Created January 6, 2010 11:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikiobraun/270216 to your computer and use it in GitHub Desktop.
Save mikiobraun/270216 to your computer and use it in GitHub Desktop.
script to compile a rails app with jrubyc and bundle
#!/bin/bash
#
# Script to bundle this rails app with compiled ruby files.
# The main problem is that rails very much assumes that files
# end in ".rb", although jruby is also fine with loading
# ".class" files.
#
# The "solution" is to replace each ".rb" file with a file
# which loads the associated ".class" file.
rm -rf bundle
mkdir bundle
for i in app bin config db lib public script Rakefile vendor
do
cp -a $i bundle/
done
jrubyc -t bundle app lib
cd bundle
for fn in $(find {app,lib} -name "*.rb")
do
cn=$(dirname $fn)/$(basename $fn .rb).class
echo >$fn "load '$cn'"
done
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment