Skip to content

Instantly share code, notes, and snippets.

@NickLaMuro
Forked from pbyrne/setup.sh
Created April 2, 2012 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NickLaMuro/2286880 to your computer and use it in GitHub Desktop.
Save NickLaMuro/2286880 to your computer and use it in GitHub Desktop.
Set Up Work Laptop
#!/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/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment