Last active
August 4, 2016 23:16
-
-
Save yrgoldteeth/190061df0909833d6d601f305c4d18b2 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
setup_os_packages() | |
{ | |
echo "Updating OS packages and install prerequisite packages" | |
sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get -y install build-essential postgresql libpq-dev git | |
} | |
setup_ruby_install() | |
{ | |
echo "Installing ruby-install" | |
mkdir -p ~/src | |
cd ~/src | |
wget -O ruby-install-0.6.0.tar.gz https://github.com/postmodern/ruby-install/archive/v0.6.0.tar.gz | |
tar -xzvf ruby-install-0.6.0.tar.gz | |
cd ruby-install-0.6.0/ | |
sudo make install | |
} | |
setup_chruby_install() | |
{ | |
echo "Installing chruby" | |
cd ~/src | |
wget -O chruby-0.3.9.tar.gz https://github.com/postmodern/chruby/archive/v0.3.9.tar.gz | |
tar -xzvf chruby-0.3.9.tar.gz | |
cd chruby-0.3.9/ | |
sudo make install | |
} | |
chruby_system_config() | |
{ | |
cat<<EOF | |
source /usr/local/share/chruby/chruby.sh | |
source /usr/local/share/chruby/auto.sh | |
EOF | |
} | |
add_chruby_to_profile() | |
{ | |
local profile_path="$HOME/.bashrc" | |
if [ -f $profile_path ] | |
then | |
echo "Adding chruby to $profile_path" | |
chruby_system_config >> $profile_path | |
fi | |
} | |
install_ruby() | |
{ | |
echo "Installing ruby 2.3.0" | |
ruby-install ruby 2.3.0 | |
} | |
install_bundler() | |
{ | |
echo "Installing bundler gem" | |
source /usr/local/share/chruby/chruby.sh | |
chruby 2.3.0 | |
gem install bundler --no-rdoc --no-ri | |
} | |
main() | |
{ | |
setup_os_packages | |
setup_ruby_install | |
setup_chruby_install | |
add_chruby_to_profile | |
install_ruby | |
install_bundler | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment