Created
March 28, 2013 08:21
-
-
Save andrewdsmith/5261571 to your computer and use it in GitHub Desktop.
A set of scripts for installing Ruby and Rails, via rbenv, in an entirely self-contained manner, i.e. with no global/system gems beyond bundler. Once you've run the install script, run `source developer_start.sh` then `rails new .` to generator your new Rails app. You'll need to run `source developer_start.sh` for each new shell where you'll be …
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
# Usage: source developer_start.sh | |
# | |
# If you execute this script rather than sourcing it, the binstubs will not be | |
# prepended to your path. | |
# Install gems in local folder (with binstubs) in lieu of using a gemset. | |
path=".bundle" | |
binstubs="$path/bin" | |
bundle install --path=$path --binstubs=$binstubs | |
# Put Bundler binstubs on the path. | |
# Using a full path because relative paths are a security threat. See | |
# http://superuser.com/questions/156582/why-is-not-in-the-path-by-default. | |
export PATH="$PWD/$binstubs:$PATH" |
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
source 'https://rubygems.org' | |
gem 'rails', '4.0.0.beta1' |
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/bash | |
# | |
# Install rbenv, ruby-build (as an rbenv extension), local Ruby and Bundler. | |
# Also ensures local documentation generation is skipped to reduce execution | |
# time and disk usage. Tested on Ubuntu 12.04. | |
# Install compilation essentials plus git for source code fetching. | |
sudo apt-get install -y build-essential git-core | |
# Install rbenv per https://github.com/sstephenson/rbenv. | |
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv | |
profile=~/.profile | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> $profile | |
echo 'eval "$(rbenv init -)"' >> $profile | |
source $profile | |
# Install ruby-build per https://github.com/sstephenson/ruby-build. | |
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build | |
# Install global Ruby version, skipping local documentation generation. | |
ruby_version=2.0.0-p0 | |
CONFIGURE_OPTS="--disable-install-doc" rbenv install $ruby_version | |
rbenv local $ruby_version | |
# Ensure gem installations skip local documentation generation. | |
cat <<GEMRC >~/.gemrc | |
install: --no-rdoc --no-ri | |
update: --no-rdoc --no-ri | |
GEMRC | |
gem install bundler | |
echo | |
echo 'Run `exec $SHELL -l` to use rbenv in the current shell.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment