Created
October 6, 2011 20:50
-
-
Save pbyrne/1268633 to your computer and use it in GitHub Desktop.
Set Up Work Laptop
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 | |
echo "Updating Homebrew and bash completion" | |
brew update | |
echo " | |
# homebrew completion files for installed libraries | |
if [ -f `brew --prefix`/etc/bash_completion ]; then | |
. `brew --prefix`/etc/bash_completion | |
fi | |
" >> ~/.bash_profile | |
#echo "Installing necessary and helpful brew packages" | |
# | |
# brew install ack git nginx | |
echo "Installing rvm" | |
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) | |
echo " | |
# This loads RVM into a shell session. | |
[[ -s '$HOME/.rvm/scripts/rvm' ]] && . '$HOME/.rvm/scripts/rvm' | |
# This helps Ruby install on Linon | |
export CC=/usr/bin/gcc-4.2 | |
" >> ~/.bash_profile | |
. ~/.bash_profile | |
echo "Adding MySQL commands to your $PATH" | |
echo ' | |
# Add our custom MySQL to the $PATH | |
export PATH=/usr/local/mysql/bin:$PATH | |
' >> ~/.bash_profile | |
. ~/.bash_profile | |
echo ' | |
# Add Homebrew the $PATH | |
export PATH=/usr/local/bin:$PATH | |
' >> ~/.bash_profile | |
. ~/.bash_profile | |
echo "Adding custom rake() function to load bundler" | |
echo ' | |
# solves issues with rake having mismatched versions with what Gemfile.lock expects | |
rake() { | |
if [[ -e ./Gemfile ]] && which bundle; then | |
bundle exec rake "$@" | |
else | |
command rake "$@" | |
fi | |
} | |
' >> ~/.bash_profile | |
. ~/.bash_profile | |
echo ' | |
# `work foo` to navigate to SHARED_WORKSPACE/foo. | |
work() { | |
dir=$(workspace) | |
cd "$dir/${1}" | |
} | |
# Used by work() and _work() to determine workspace your projects live in. Set | |
# the SHARED_WORKSPACE environment variable if this is not ~/workspace/. | |
workspace() { | |
result=$([ -s "$SHARED_WORKSPACE" ] && echo $SHARED_WORKSPACE || echo "~/workspace/") | |
echo "$result" | |
} | |
# bash completion function for work(). Allows you to type `work f` to | |
# auto-complete to `work foo`, following standard Bash directory-completion | |
# rules. | |
_work() { | |
local cur | |
local trim | |
local dir=$(workspace) | |
cur=${COMP_WORDS[COMP_CWORD]} | |
# length of expanded path, used to trim off first portion of matched paths below | |
trim=`echo $dir/ | wc -c` | |
# perform completion, returning all directories in workspace, trimming off the path to the workspace | |
COMPREPLY=( $( compgen -S/ -d $dir/$cur | cut -b $trim- ) ) | |
} | |
# enable completion for work() function using _work(), but only if `complete` exists | |
command -v complete > /dev/null && complete -o nospace -F _work work | |
' >> ~/.bash_profile | |
. ~/.bash_profile | |
echo ' | |
# necessary for mysql gem when using mysql 5.5 on mac os x | |
export DYLD_LIBRARY_PATH="/usr/local/mysql/lib/:$DYLD_LIBRARY_PATH" | |
' >> ~/.bash_profile | |
. ~/.bash_profile | |
echo "Setting up global gems" | |
echo "rake" >> ~/.rvm/gemsets/global.gems | |
echo "bundler" >> ~/.rvm/gemsets/global.gems | |
echo "simple-scm" >> ~/.rvm/gemsets/global.gems | |
echo "Installing REE" | |
rvm install ree-1.8.7-2011.12 | |
echo "Installing 1.9.2 and setting as default" | |
rvm install ruby-1.9.2-p290 | |
rvm use 1.9.2-p290 --default | |
echo "Starting Mongo" | |
mkdir -p ~/Library/LaunchAgents | |
cp /usr/local/Cellar/mongodb/1.8.3-x86_64/org.mongodb.mongod.plist ~/Library/LaunchAgents/ | |
launchctl load -w ~/Library/LaunchAgents/org.mongodb.mongod.plist | |
echo "Setting up shared assets directory. You'll be prompted for your password" | |
sudo chown -R `whoami` /local/tst/assets/ |
Yeah, it seems like it used to, but in new versions that I have install on my machines that doesn't seem to be the case... not sure why.
Also, there is something similar with the stat_ngin app in the .rvmrc... not sure if you want to do anything with that as well.
Ah ha. I'll leave that you to to clean up. :)
Sure thing ;)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hrm, I thought it just went ahead and used the latest version of 1.9.2 when you don't specify. This might have changed or I'm simply wrong. Anyway, applying your suggestion to the gist.