Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 128 lines (96 sloc) 4.403 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
#!/usr/bin/env bash

# Check if git is installed
git --version 2>&1 >/dev/null
if [ $? -ne 0 ]; then
echo "Git is not installed, please install it before running this script"
exit 1
fi

echo "Starting installation..."

# the current user must be the owner of /usr/local/*
sudo chown -R `id -nu` /usr/local/

# First check for dependencies
echo "[Dependency] Command Line Tools"
  [[ -f /usr/bin/cc ]] || (echo "You need to download and install Command Line Tools. Look for ctools_lion_*.dmg"; exit)

# Oh-my-zsh
echo "Installing Oh-my-zsh, to enhance your shell ..."
if [ ! -d ~/.oh-my-zsh ]; then
  curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
else
echo "You already have Oh My Zsh installed. You'll need to remove ~/.oh-my-zsh if you want to install !"
fi

# Setup SSH
echo "Checking for SSH key, generating one if it doesn't exist ..."
  [[ -f ~/.ssh/id_rsa.pub ]] || ssh-keygen -t rsa

echo "Copying public key to clipboard. Paste it into your Github account ..."
  [[ -f ~/.ssh/id_rsa.pub ]] && cat ~/.ssh/id_rsa.pub | pbcopy
  open https://github.com/settings/ssh

# Install Stuff
echo "Installing Homebrew, a good OS X package manager ..."
/usr/bin/ruby -e "$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/go)"
  brew update

#echo "Put Homebrew location earlier in PATH ..."
#Homebrew path is in .zshenv

source ~/.zshrc
source ~/.zshenv

mkdir -p ~/Library/LaunchAgents # Will put startup scripts here

echo "Installing Redis, a good key-value database ..."
  brew install redis
  echo "Configuring Redis so that it starts at startup ..."
  REDIS_CURRENT_PLIST=~/Library/LaunchAgents/homebrew.mxcl.redis.plist
  [[ -f ~/.ssh/id_rsa.pub ]] || launchctl unload -w REDIS_CURRENT_PLIST
  
  REDIS_PLIST=`ls /usr/local/Cellar/redis/*/homebrew.mxcl.redis.plist | tail -1`
  echo "Copying $REDIS_PLIST to ~/Library/LaunchAgents/"
  cp $REDIS_PLIST ~/Library/LaunchAgents/
  launchctl load -w $REDIS_CURRENT_PLIST

echo "Installing MongoDB, a good NoSQL database ..."
  brew install mongodb
  echo "Configuring MongoDB so that it starts at startup ..."
  MONGO_CURRENT_PLIST=~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
  [[ -f ~/.ssh/id_rsa.pub ]] || launchctl unload -w $MONGO_CURRENT_PLIST
  
  MONGO_PLIST=`ls /usr/local/Cellar/mongodb/*/homebrew.mxcl.mongodb.plist | tail -1`
  MONGO_CONFIG=`ls /usr/local/Cellar/mongodb/*/mongod.conf | tail -1`
  echo "Copying $MONGO_PLIST to ~/Library/LaunchAgents/"
  echo "Copying $MONGO_CONFIG to /usr/local/etc/"
  cp $MONGO_PLIST ~/Library/LaunchAgents/
  if [[ ! -d /data/db ]]; then
    echo "Need your password to sudo to create the folder /data/db";
sudo mkdir -p /data/db;
sudo chown `id -u` /data/db
  fi
  cp $MONGO_CONFIG /usr/local/etc/mongod.conf
  launchctl load -w $MONGO_CURRENT_PLIST

echo "Installing NodeJS ..."
  curl http://npmjs.org/install.sh | sh

echo "Installing ack, a good way to search through files ..."
  brew install ack

echo "Install ssh-copy-id, because you just want to type your password once..."
  brew install ssh-copy-id
  
echo "Installing tmux, a good way to save project state and switch between projects ..."
  brew install tmux

echo "Installing image, good for cropping and re-sizing images ..."
  brew install imagemagick --disable-openmp --with-magick-plus-plus

echo "Installing automake, which is need for doing rvm install --with-gcc=clang"
  brew install automake

echo "Installing RVM (Ruby Version Manager) ..."
  curl -L https://get.rvm.io | bash -s stable --ruby

# RVM
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

bash < <(curl -s https://raw.github.com/applidget/laptop/master/ruby)

#empties the .zprofile (avoid conflicts for RVM)
echo '' > ~/.zprofile


echo "Adding useful aliases and Applidget's configuration ..."
  echo "

# Auto CD
setopt auto_cd
cdpath=(~ ~/code/ror ~/code/ios ~/code/node ~/code/cpp)
" >> ~/.zshrc
 # source ~/.zshrc

# Setting up Applidget defaults code directories
echo "Setting up ~/code directory. That's where you gonna work buddy ..."
mkdir -p ~/code/ror/watched
mkdir -p ~/code/node/watched
mkdir -p ~/code/ios/watched

# Textmate files
# now included with other dotfiles

echo "Please source your .zshrc in a oh-my-zsh terminal after installation"
echo "Now fork the dotfiles repo (https://github.com/ssaunier/dotfiles), and follow instructions (customizing .zshenv, ...)"
Something went wrong with that request. Please try again.