# Install all prerequisites
os=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
yum install git-core zlib zlib-devel gcc-c++ patch readline readline-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison curl sqlite-devel
cd
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
exec $SHELL
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash
source ~/.bashrc
# Install the ruby version which you want
rbenv install 2.3.1
rbenv global 2.3.1
gem install rails -v 4.2.1 --no-ri --no-rdoc
#modify this to take versions in cmd argument
# This should be get enough to get rails up and running in fedora
# TODO:
# Make this a generic script to run on both debian as well as rpm based systems.
# Make it fail safe. If some step fails in the middle then add capability to resume
# from the failed step instead of starting from beginning.