Last active
August 31, 2015 20:45
-
-
Save ismailakbudak/9fb946df9f6ec469c7db to your computer and use it in GitHub Desktop.
deploy-user-ruby-environment.sh
This file contains hidden or 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
## Run this command with deploy user | |
# define user home path | |
user_path=/home/deploy | |
## Fancy echo | |
fancy_echo() { | |
printf "\n%b\n" "$1" | |
} | |
fancy_echo "Installing rbenv..." | |
git clone git://github.com/sstephenson/rbenv.git $user_path/.rbenv | |
fancy_echo "Writing rbenv path to bashrc ..." | |
echo 'export PATH=\"$HOME/.rbenv/bin:$PATH\"' >> $user_path/.bashrc | |
echo 'eval "$(rbenv init -)"' >> $user_path/.bashrc | |
fancy_echo "Exporting rbenv path..." | |
export PATH="$HOME/.rbenv/bin:$PATH" | |
eval "$(rbenv init -)" | |
fancy_echo "Preparing rbenv plugins..." | |
mkdir -p $user_path/.rbenv/plugins | |
git clone https://github.com/sstephenson/ruby-build.git $user_path/.rbenv/plugins/ruby-build | |
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> $user_path/.bashrc | |
git clone https://github.com/sstephenson/rbenv-gem-rehash.git $user_path/.rbenv/plugins/rbenv-gem-rehash | |
## Ruby environment | |
RUBY_VERSION="2.2.3" | |
fancy_echo "Installing Ruby $RUBY_VERSION ..." | |
rbenv install $RUBY_VERSION | |
rbenv rehash | |
rbenv global $RUBY_VERSION | |
ruby -v | |
fancy_echo "Gem update system ..." | |
gem update --system | |
fancy_echo "Echo .gemrc..." | |
echo 'gem: --no-rdoc --no-ri' >> $user_path/.gemrc | |
gem install bundler | |
gem install backup | |
rbenv rehash | |
fancy_echo "Export path ..." | |
echo "export PATH="$PATH:/usr/bin"" >> $user_path/.bashrc | |
exec $SHELL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment