1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
#!/bin/sh
echo "This script will update your shell profile when the 'bin' directory"
echo "of jruby is not early enough of the PATH of your shell."
echo "These changes will be effective only in shell windows that you open"
echo "after running this script."
JRUBYVER="1.7.0.preview1"
JRUBY_ROOT="/Library/Frameworks/JRuby.framework/Versions"
JRUBY_VERSION_PATH="$JRUBY_ROOT/$JRUBYVER"
JRUBY_CURRENT_PATH="$JRUBY_ROOT/Current"
JRUBY_INSTALLER_LOG="$TMPDIR/jruby.installer.log"
JRUBY_INSTALLER_ERR="$TMPDIR/jruby.installer.err"
if [ -d $JRUBY_CURRENT_PATH ]
then
rm -rf $JRUBY_CURRENT_PATH
fi
# create symlink to the current directory
ln -s $JRUBY_VERSION_PATH $JRUBY_CURRENT_PATH
# install native launcher
$JRUBY_VERSION_PATH/bin/jruby -S gem install jruby-launcher --no-ri --no-rdoc > $JRUBY_INSTALLER_LOG 2> $JRUBY_INSTALLER_ERR
# check if a previous verison of JRuby exists. Perhaps it's less safe but
# it's also less hacky and if the user changes his path we keep his choice
INSTALLED_VERSIONS=`ls $JRUBY_ROOT | wc -l`
if [ $INSTALLED_VERSIONS -gt 2 ]
then
echo "Seems JRuby was previously installed, skipping path modification" >> $JRUBY_INSTALLER_LOG
exit 0
fi
dirname=`dirname $0`
. "$dirname/patch_profile"
try_patch_profile
|