Skip to content

Instantly share code, notes, and snippets.

@tayfunoziserikan
Last active December 21, 2015 04:58
Show Gist options
  • Save tayfunoziserikan/6253168 to your computer and use it in GitHub Desktop.
Save tayfunoziserikan/6253168 to your computer and use it in GitHub Desktop.
Linux Laptop Setup
#!/usr/bin/env zsh
# Common functions
is_successfully() {
$* || (echo "\nfailed" 1>&2 && exit 1)
}
new_line_echo() {
echo "\n$1"
}
# Distro check
if ! grep -qiE 'precise|quantal|wheezy|raring|jessie' /etc/os-release
then
new_line_echo "Sorry! we don't currently support that distro."
exit 1
fi
# Debian package update
new_line_echo "Updating system packages ..."
if command -v aptitude >/dev/null; then
new_line_echo "Using aptitude ..."
else
new_line_echo "Installing aptitude ..."
is_successfully sudo apt-get install -y aptitude
fi
is_successfully sudo aptitude update
is_successfully sudo aptitude -y dist-upgrade
# Install debian derivative packages
new_line_echo "Installing git, for source control management ..."
is_successfully sudo aptitude install -y git
new_line_echo "Installing base ruby build dependencies ..."
is_successfully sudo aptitude build-dep -y ruby1.9.3
new_line_echo "Installing libraries for common gem dependencies ..."
is_successfully sudo aptitude install -y libxslt1-dev libcurl4-openssl-dev libksba8 libksba-dev libqtwebkit-dev
new_line_echo "Installing Postgres, a good open source relational database ..."
is_successfully sudo aptitude install -y postgresql postgresql-server-dev-all
new_line_echo "Installing Redis, a good key-value database ..."
is_successfully sudo aptitude install -y redis-server
new_line_echo "Installing ImageMagick, to crop and resize images ..."
is_successfully sudo aptitude install -y imagemagick
new_line_echo "Installing watch, to execute a program periodically and show the output ..."
is_successfully sudo aptitude install -y watch
# Install rbenv
new_line_echo "Installing rbenv, to change Ruby versions ..."
is_successfully git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
if ! grep -qs "rbenv init" ~/.zshrc; then
is_successfully echo 'export PATH="$HOME/bin:$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
is_successfully echo 'eval "$(rbenv init -)"' >> ~/.zshrc
fi
source ~/.zshrc
new_line_echo "Installing rbenv-gem-rehash so the shell automatically picks up binaries after installing gems with binaries..."
is_successfully git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash
new_line_echo "Installing ruby-build, to install Rubies ..."
is_successfully git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
# Install ruby environment
new_line_echo "Installing Ruby 2.0.0-p247 ..."
is_successfully rbenv install 2.0.0-p247
new_line_echo "Setting Ruby 2.0.0-p247 as global default Ruby ..."
is_successfully rbenv global 2.0.0-p247
is_successfully rbenv rehash
new_line_echo "Updating to latest Rubygems version ..."
is_successfully gem update --system
new_line_echo "Installing critical Ruby gems for Rails development ..."
is_successfully gem install bundler pg rails unicorn --no-document
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment