Created
August 23, 2012 18:55
-
-
Save sbeam/3440285 to your computer and use it in GitHub Desktop.
Ruby version management on Debian
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/capistrano" # runs bundle:install on remote for us | |
# give cap the correct path to our custom installed rubies | |
default_environment['PATH'] = "/usr/local/ruby/bin:/usr/bin:/bin" | |
# ... rest of normal cap config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This is not meant to be used as an actual script. | |
# Just the series of commands I run from the command line to set things up. | |
# git and the usual build dependencies needed to get a fully operational ruby | |
apt-get update | |
apt-get install git build-essential libssl-dev libreadline5-dev libxml2 libxml2-dev libxslt1-dev | |
readline-common openssl zlib1g zlib1g-dev make gcc autoconf libtool file curl libcurl4-openssl-dev | |
# clone and install ruby-build | |
git clone git://github.com/sstephenson/ruby-build.git /usr/local/src/ruby-build | |
cd /usr/local/src/ruby-build | |
./install.sh | |
# install ruby | |
cd /usr/local | |
ruby-build 1.9.3-p194 /usr/local/ruby-1.9.3-194 | |
# setup ruby as default ruby using alternatives | |
# See `man update-alternatives` for information on how to switch between | |
# versions of ruby. You can either manually switch between them or | |
# assign each install a priority that will automatically determine which | |
# version should be used. | |
update-alternatives --install /usr/local/ruby ruby /usr/local/ruby-1.9.3-194 0 | |
# OR, just symlink the installed ruby to /usr/local/ruby. Pretty much the same | |
# effect, and a little more straightforward | |
ln -s ruby-1.9.3-194 ruby | |
# now, install bundler for use by capistrano below | |
/usr/local/ruby/bin/gem install bundler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ruby initialization script (sh) | |
# Place this in /etc/profile.d | |
# Fedora is notorious for being late with updates to ruby versions. | |
# This is a modified version of the qt script to apend the bin paths | |
# to the PATH and set the lib/include directories. | |
# I used ruby-build https://github.com/sstephenson/ruby-build to install | |
# the rubies to /usr/local/ruby-xxx and used alternatives to install one | |
# as the current one. This script is meant to append the alternative | |
# maintained path (/usr/local/ruby/bin) to the PATH variable so that the | |
# right version of ruby and any installed gems commands are correctly | |
# found. With this, the system ruby packages are no longer needed | |
if [ -z "${RUBYDIR}" ]; then | |
if [ -d "/usr/local/ruby" ]; then | |
RUBYDIR="/usr/local/ruby" | |
if ! echo ${PATH} | /bin/grep -q $RUBYDIR/bin ; then | |
PATH=$RUBYDIR/bin:${PATH} | |
fi | |
RUBYINC="$RUBYDIR/include" | |
RUBYLIB="$RUBYDIR/lib" | |
export RUBYDIR RUBYINC RUBYLIB PATH | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment