Skip to content

Instantly share code, notes, and snippets.

@AlecTaylor
Created February 15, 2014 12:11
Show Gist options
  • Save AlecTaylor/9018523 to your computer and use it in GitHub Desktop.
Save AlecTaylor/9018523 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
RUBY_VERSION=2.1.0
printf "Installing Ruby $RUBY_VERSION\\n"
if [ -d ruby_build ]; then
rm -Rf ruby_build
fi
if [[ ! (`command -v ruby` && `ruby --version | colrm 13` == "ruby" "$RUBY_VERSION""p0") ]] ; then
sudo apt-get build-dep -y ruby1.9.1
mkdir ruby_build && cd ruby_build
curl -O "http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-$RUBY_VERSION.tar.gz"
tar xf "ruby-$RUBY_VERSION.tar.gz"
cd "ruby-$RUBY_VERSION"
./configure
make
sudo checkinstall -y --pkgversion "$RUBY_VERSION" --provides "ruby-interpreter" --replaces="ruby-1.9.2"
rm -Rf ruby_build
else
echo "You already have this version of Ruby: $RUBY_VERSION"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment