#!/bin/sh

ruby_standalone_dir=/usr/lib/ruby-standalone
shell=$(getent passwd $USER | cut -d : -f 7)

export RUBY_STANDALONE='/usr/lib/ruby-standalone'
export RUBY="${ruby_standalone_dir}/bin/ruby"
export PATH="$($RUBY -e 'puts Gem.user_dir')/bin:${ruby_standalone_dir}/bin:${PATH}"

if [ $# -eq 0 ]; then
  exec "$shell"
else
  exec "$@"
fi
