JRuby

From GeilThings

Jump to: navigation, search
JRuby
General
Version 1.7.4
Stable 1.7.4
Function Programming Language
Scripts


Contents

General

Installing JRuby

cd /opt
wget http://jruby.org.s3.amazonaws.com/downloads/1.6.5.1/jruby-bin-1.6.5.1.tar.gz
tar -zxvf jruby-bin-1.6.5.1.tar.gz
cd /opt
ln -s jruby-1.6.5.1 /opt/jruby
 
# Create an alias.
alias jruby='/opt/jruby/bin/jruby'
# Add the line above also to /root/.bashrc and /home/username/.bashrc or /etc/bashrc to be used as system wide alias

Updating JRuby

  • Started with 1.6.5.1.
APPNAME=jruby
RAWOLDVERSION=`/opt/jruby/bin/jruby -v`
# Format:
# jruby 1.6.7 (ruby-1.8.7-p357) (2012-02-22 3e82bc8) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_31) [linux-amd64-java]
OLDVERSION=`echo "$RAWOLDVERSION" | grep -Po '^.*?\K(?<=jruby ).*?(?= \()'`
echo $OLDVERSION
RAWNEWVERSION=`curl -sd "action=ask&query=[[JRuby]]|%3FStable&format=json" http://www.geilthings.com/api.php` 
NEWVERSION=`echo "$RAWNEWVERSION" | grep -Po '^.*?\K(?<=Stable\":\[\").*?(?=\")'`  
echo $NEWVERSION
 
if [[ ${OLDVERSION} != ${NEWVERSION} ]]; then
  echo ${APPNAME}: installed: ${OLDVERSION}, actual: ${NEWVERSION}
  echo "You could update ${APPNAME} to ${NEWVERSION}"
  echo "Would you like to install ${APPNAME} ${NEWVERSION} y/n?"
  read item
  if [[ "$item" == "y" || "$item" == "Y" ]]; then
    echo "Installing ${APPNAME} ${NEWVERSION}. Follow instructions."
  else
    echo "Exit"
  fi
else
  echo "You don't need to update ${APPNAME}; it is uptodate (${NEWVERSION})"
fi
 
# Get the file
cd /opt
wget http://jruby.org.s3.amazonaws.com/downloads/${NEWVERSION}/jruby-bin-${NEWVERSION}.tar.gz
 
tar -zxvf jruby-bin-${NEWVERSION}.tar.gz
 
# Modify the jruby soft link.
cd /opt
rm -f /opt/jruby
ln -s jruby-${NEWVERSION} /opt/jruby
 
# Check. Version should be the NEWVERSION.
/opt/jruby/bin/jruby -v
 
# Check cli. Leave the cli with "quit".
/opt/jruby/bin/jruby -S jirb
quit
 
# Check applications.
# ...
 
# Rename the old version directory and delete it some weeks later.
mv /opt/jruby-${OLDVERSION} /opt/old_jruby-${OLDVERSION}
  • Windows: Uninstall jruby first.

Issues

  • jRuby 1.7.0.preview2, JDK 1.7.0_05, CentOS 6.3: java.lang.ClassNotFoundException: org.objectweb.asm.ClassReader
See also http://jira.codehaus.org/browse/JRUBY-6037
Solution: Unknown to me. It should not break anything according to Charles Nutter, jRuby developer. As a matter of fact I only see it when running "jruby -v"

Versions

Software name Version number Version date
JRuby 1.7.1
1.7.2
1.7.3
1.7.4
8 December 2012
8 January 2013
21 February 2013
18 May 2013

Comments

blog comments powered by Disqus