Skip to content

Instantly share code, notes, and snippets.

@chhibber
Created June 27, 2013 17:43
Show Gist options
  • Save chhibber/5878628 to your computer and use it in GitHub Desktop.
Save chhibber/5878628 to your computer and use it in GitHub Desktop.
rbenv_install.sh
#!/bin/bash
set -e
set -x
CURRENT=`pwd`
RBENV_VERSION=1.9.3-p429
#[ -z "$1" ] && { echo "No version set - check pillar data"; exit 1 }
#echo "First Variable: ${1}"
[ -f .install ] && . .install
[ ! -z $RBENV_ROOT ] || RBENV_ROOT=/usr/local/rbenv
#[ ! -z $RBENV_VERSION ] || RBENV_VERSION=1.9.3-p392
[ ! -z $RBENV_VERSION ] || RBENV_VERSION=1.9.3-p374
echo Install rbenv to $RBENV_ROOT with install $RBENV_VERSION...
if [ -d ${RBENV_ROOT}/versions/${RBENV_VERSION} ]; then
echo "Ruby ${RBENV_VERSION} is already installed"
exit 0
fi
if [ -d ${RBENV_ROOT} ]; then
echo rbenv is already installed. So updating...
cd $RBENV_ROOT
git pull
cd plugins/ruby-build
git pull
else
mkdir -p $RBENV_ROOT
cd $RBENV_ROOT
git clone https://github.com/sstephenson/rbenv.git .
mkdir -p plugins
git clone https://github.com/sstephenson/ruby-build.git plugins/ruby-build
fi
cd $CURRENT
export RBENV_ROOT
export RBENV_VERSION
echo "Install version ${RBENV_VERSION}"
$RBENV_ROOT/bin/rbenv install $RBENV_VERSION
$RBENV_ROOT/bin/rbenv rehash
cd $CURRENT
export RBENV_ROOT
export RBENV_VERSION
echo "Install version ${RBENV_VERSION}"
$RBENV_ROOT/bin/rbenv install $RBENV_VERSION
$RBENV_ROOT/bin/rbenv rehash
echo Install bundler...
$RBENV_ROOT/bin/rbenv exec gem install bundler --no-ri --no-rdoc
$RBENV_ROOT/bin/rbenv exec gem install foreman --no-ri --no-rdoc
$RBENV_ROOT/bin/rbenv exec gem install fpm --no-ri --no-rdoc
$RBENV_ROOT/bin/rbenv rehash
cd /srv/salt/rpms
/usr/local/rbenv/versions/${RBENV_VERSION}/bin/fpm -s dir -t rpm -n rbenv-ruby -v ${RBENV_VERSION} /usr/local/rbenv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment