Created
January 14, 2012 20:38
-
-
Save gmccreight/1612813 to your computer and use it in GitHub Desktop.
All the pants that are fit to fit
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 | |
# Usage: | |
# (first time) | |
# ./anujypants.sh from_scratch | |
# (subsequently) | |
# ./anujypants.sh | |
#----------------------------------------------------------------------------- | |
# Load RVM into a shell session *as a function* | |
#----------------------------------------------------------------------------- | |
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then | |
# First try to load from a user install | |
source "$HOME/.rvm/scripts/rvm" | |
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then | |
# Then try to load from a root install | |
source "/usr/local/rvm/scripts/rvm" | |
else | |
printf "ERROR: An RVM installation was not found.\n" | |
exit 1 | |
fi | |
#----------------------------------------------------------------------------- | |
# Create the anujypants gemset in ruby 1.9.2 | |
#----------------------------------------------------------------------------- | |
rvm 1.9.2 | |
if [[ $1 = "from_scratch" ]] ; then | |
rvm --force gemset delete anujypants | |
rvm gemset create anujypants | |
fi | |
rvm 1.9.2@anujypants | |
#----------------------------------------------------------------------------- | |
# Install rails 3.1.3, then run bundler to install all the other stuff | |
#----------------------------------------------------------------------------- | |
if [[ $1 = "from_scratch" ]] ; then | |
gem install rails -v=3.1.3 --no-rdoc --no-ri | |
rm -rf anujypants | |
rails new anujypants | |
cd anujypants | |
bundle | |
else | |
cd anujypants | |
fi | |
#----------------------------------------------------------------------------- | |
# Write the actual script | |
#----------------------------------------------------------------------------- | |
cat > lib/myFunnyIronicTshirt.rb <<ENDOFFILE | |
#!/usr/bin/env ruby | |
require 'rails/all' | |
p Rails.env | |
ENDOFFILE | |
chmod 700 lib/myFunnyIronicTshirt.rb | |
./lib/myFunnyIronicTshirt.rb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment