Skip to content

Instantly share code, notes, and snippets.

@JorgenEvens
Last active December 19, 2015 17:08
Show Gist options
  • Save JorgenEvens/5988835 to your computer and use it in GitHub Desktop.
Save JorgenEvens/5988835 to your computer and use it in GitHub Desktop.
Create a jar which allows the usage of sass and compass through jruby (JVM). This allows you to use sass without having to install Ruby on your system.
#!/bin/sh
# Download a copy of the jruby-complete jar [here](http://www.jruby.org/download),
# and pass it as the first parameter to the script.
JRUBY="$1"
JAVA="java"
# Install compass / sass gems.
$JAVA -jar "$JRUBY" -S gem install compass -i ./tmp/gems
$JAVA -jar "$JRUBY" -S gem install --version '~> 0.9' rb-inotify -i ./tmp/gems
# Create a copy to which we will be adding compass / sass
cp $JRUBY ./tmp/sass.jar
# Cleanup and reorganize structure
rm -R ./tmp/gems/cache
rm -R ./tmp/gems/doc
mkdir -p ./tmp/gems/META-INF/jruby.home
mv ./tmp/gems/bin ./tmp/gems/META-INF/jruby.home/bin
# Bundle gems into jar
jar uf ./tmp/sass.jar -C ./tmp/gems .
# Cleanup
mv ./tmp/sass.jar .
rm -R ./tmp
echo "done. You can now use the jar as follows:"
echo "java -jar sass.jar -S sass --help"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment