Commit 0a2eda63 by David Baumgold

Switch from RVM to rbenv

parent f3a484bd
...@@ -65,7 +65,7 @@ info() { ...@@ -65,7 +65,7 @@ info() {
cat<<EO cat<<EO
edX base dir : $BASE edX base dir : $BASE
Python virtualenv dir : $PYTHON_DIR Python virtualenv dir : $PYTHON_DIR
Ruby RVM dir : $RUBY_DIR Ruby rbenv dir : $RBENV_ROOT
Ruby ver : $RUBY_VER Ruby ver : $RUBY_VER
EO EO
...@@ -131,9 +131,16 @@ BASE="${PROJECT_HOME:-$(set_base_default)}" ...@@ -131,9 +131,16 @@ BASE="${PROJECT_HOME:-$(set_base_default)}"
# unless you've already got one set up with virtualenvwrapper. # unless you've already got one set up with virtualenvwrapper.
PYTHON_DIR=${WORKON_HOME:-"$HOME/.virtualenvs"} PYTHON_DIR=${WORKON_HOME:-"$HOME/.virtualenvs"}
# RVM defaults its install to ~/.rvm, but use the overridden rvm_path # Find rbenv root (~/.rbenv by default)
# if that's what's preferred. if [ -z "${RBENV_ROOT}" ]; then
RUBY_DIR=${rvm_path:-"$HOME/.rvm"} RBENV_ROOT="${HOME}/.rbenv"
else
RBENV_ROOT="${RBENV_ROOT%/}"
fi
# Let the repo override the version of Ruby to install
if [[ -r $BASE/edx-platform/.ruby-version ]]; then
RUBY_VER=`cat $BASE/edx-platform/.ruby-version`
fi
LOG="/var/tmp/install-$(date +%Y%m%d-%H%M%S).log" LOG="/var/tmp/install-$(date +%Y%m%d-%H%M%S).log"
...@@ -249,7 +256,7 @@ case `uname -s` in ...@@ -249,7 +256,7 @@ case `uname -s` in
if [[ ! $noninteractive ]]; then if [[ ! $noninteractive ]]; then
warning " warning "
Debian support is not fully debugged. Assuming you have standard Debian support is not fully debugged. Assuming you have standard
development packages already working like scipy rvm, the development packages already working like scipy, the
installation should go fine, but this is still a work in progress. installation should go fine, but this is still a work in progress.
Please report issues you have and let us know if you are able to figure Please report issues you have and let us know if you are able to figure
...@@ -267,9 +274,6 @@ case `uname -s` in ...@@ -267,9 +274,6 @@ case `uname -s` in
While we don't technically support this release, the install While we don't technically support this release, the install
script will probably still work. script will probably still work.
Raring requires an install of rvm to work correctly as the raring
package manager does not yet include a package for rvm
Press return to continue or control-C to abort" Press return to continue or control-C to abort"
read dummy read dummy
fi fi
...@@ -318,7 +322,7 @@ EO ...@@ -318,7 +322,7 @@ EO
esac esac
# Clone MITx repositories # Clone edx repositories
clone_repos clone_repos
...@@ -333,90 +337,39 @@ else ...@@ -333,90 +337,39 @@ else
fi fi
# Install system-level dependencies # Install system-level dependencies
if [[ ! -d $RBENV_ROOT ]]; then
output "Installing RVM, Ruby, and required gems" output "Installing rbenv"
git clone https://github.com/sstephenson/rbenv.git $RBENV_ROOT
# If we're not installing RVM in the default location, then we'll do some
# funky stuff to make sure that we load in the RVM stuff properly on login.
if [ "$HOME/.rvm" != $RUBY_DIR ]; then
if ! grep -q "export rvm_path=$RUBY_DIR" ~/.rvmrc; then
if [[ -f $HOME/.rvmrc ]]; then
output "Copying existing .rvmrc to .rvmrc.bak"
cp $HOME/.rvmrc $HOME/.rvmrc.bak
fi
output "Creating $HOME/.rvmrc so rvm uses $RUBY_DIR"
echo "export rvm_path=$RUBY_DIR" > $HOME/.rvmrc
fi
fi fi
if [[ ! -d $RBENV_ROOT/plugins/ruby-build ]]; then
# Let the repo override the version of Ruby to install output "Installing ruby-build"
if [[ -r $BASE/edx-platform/.ruby-version ]]; then git clone https://github.com/sstephenson/ruby-build.git $RBENV_ROOT/plugins/ruby-build
RUBY_VER=`cat $BASE/edx-platform/.ruby-version`
fi fi
shelltype=$(basename $SHELL)
# rvm has issues in debian family, this is taken from stack overflow if ! hash rbenv 2>/dev/null; then
case `uname -s` in output "Adding rbenv to \$PATH in ~/.${shelltype}rc"
Darwin) echo "export PATH=\"$RBENV_ROOT/bin:\$PATH\"" >> $HOME/.${shelltype}rc
curl -sSL get.rvm.io | bash -s -- --version 1.15.7 echo 'eval "$(rbenv init -)"' >> $HOME/.${shelltype}rc
;; export PATH="$RBENV_ROOT/bin:$PATH"
eval "$(rbenv init -)"
[Ll]inux)
warning "Setting up rvm on linux. This is a known pain point. If the script fails here
refer to the following stack overflow question:
http://stackoverflow.com/questions/9056008/installed-ruby-1-9-3-with-rvm-but-command-line-doesnt-show-ruby-v/9056395#9056395"
sudo apt-get --purge remove -yq ruby-rvm
sudo rm -rf /usr/share/ruby-rvm /etc/rvmrc /etc/profile.d/rvm.sh
curl -sSL https://get.rvm.io | bash -s stable --ruby=$RUBY_VER --autolibs=enable --auto-dotfiles
;;
esac
# Ensure we have RVM available as a shell function so that it can mess
# with the environment and set everything up properly. The RVM install
# process adds this line to login scripts, so this shouldn't be necessary
# for the user to do each time.
if [[ `type -t rvm` != "function" ]]; then
source $RUBY_DIR/scripts/rvm
fi fi
# Ruby doesn't like to build with clang, which is the default on OS X, so if [[ ! -d $RBENV_ROOT/versions/$RUBY_VER ]]; then
# use gcc instead. This may not work, since if your gcc was installed with output "Installing Ruby $RUBY_VER"
# XCode 4.2 or greater, you have an LLVM-based gcc, which also doesn't rbenv install $RUBY_VER
# always play nicely with Ruby, though it seems to be better than clang. rbenv global $RUBY_VER
# You may have to install apple-gcc42 using Homebrew if this doesn't work. fi
# See `rvm requirements` for more information.
case `uname -s` in
Darwin)
export CC=gcc
;;
esac
# Current stable version of RVM (1.19.0) requires the following to build Ruby: if ! hash bundle 2>/dev/null; then
# output "Installing gem bundler"
# autoconf automake libtool pkg-config libyaml libxml2 libxslt libksba openssl gem install bundler
# fi
# If we decide to upgrade from the current version (1.15.7), can run rbenv rehash
#
# LESS="-E" rvm install $RUBY_VER --autolibs=3 --with-readline
#
# to have RVM look for a package manager like Homebrew and install any missing
# libs automatically. RVM's --autolibs flag defaults to 2, which will fail if
# any required libs are missing.
LESS="-E" rvm install $RUBY_VER --with-readline
# Create the "edx" gemset
rvm use "$RUBY_VER@edx-platform" --create
rvm rubygems latest
output "Installing gem bundler"
gem install bundler
output "Installing ruby packages" output "Installing ruby packages"
bundle install --gemfile $BASE/edx-platform/Gemfile bundle install --gemfile $BASE/edx-platform/Gemfile
# Install Python virtualenv # Install Python virtualenv
output "Installing python virtualenv" output "Installing python virtualenv"
case `uname -s` in case `uname -s` in
...@@ -528,7 +481,6 @@ pip install -r $BASE/edx-platform/requirements/edx/pre.txt ...@@ -528,7 +481,6 @@ pip install -r $BASE/edx-platform/requirements/edx/pre.txt
output "Installing edX requirements" output "Installing edX requirements"
# Install prereqs # Install prereqs
cd $BASE/edx-platform cd $BASE/edx-platform
rvm use "$RUBY_VER@edx-platform"
rake install_prereqs rake install_prereqs
# Final dependecy # Final dependecy
...@@ -559,11 +511,10 @@ if [[ ! $quiet ]]; then ...@@ -559,11 +511,10 @@ if [[ ! $quiet ]]; then
Success!! Success!!
To start using Django you will need to activate the local Python To start using Django you will need to activate the local Python
and Ruby environments. Ensure the following lines are added to your environment. Ensure the following lines are added to your
login script, and source your login script if needed: login script, and source your login script if needed:
source `which virtualenvwrapper.sh` source `which virtualenvwrapper.sh`
source $RUBY_DIR/scripts/rvm
Then, every time you're ready to work on the project, just run Then, every time you're ready to work on the project, just run
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment