Skip to content

Instantly share code, notes, and snippets.

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 leylaKapi/3fd8ead2b6fecb835a27 to your computer and use it in GitHub Desktop.
Save leylaKapi/3fd8ead2b6fecb835a27 to your computer and use it in GitHub Desktop.
deploy-user-ruby-2.2.2-environment.sh
## 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
fancy_echo "Installing Ruby 2.2.2 ..."
rbenv install 2.2.2
rbenv rehash
rbenv global 2.2.2
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