Created
January 7, 2014 03:04
-
-
Save alex-zige/8294060 to your computer and use it in GitHub Desktop.
Shell script for one-command bootstrap rails 4 project with ruby 2.0.0. [4.0.2] latest version. Please put the code into your ~/.bash_profile and call bootstrap_rails4 in terminal inside your target folder
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
function set_ruby2_with_gemset(){ | |
local result=${PWD##*/} | |
local result=${result// /_} | |
local result=$(echo $result | tr '[A-Z]' '[a-z]') | |
echo "prepare ruby 2.0 with gemset "$result | |
rvm --create ruby-2.0.0-p247@$result | |
} | |
function use_ruby2_with_gemset(){ | |
local result=${PWD##*/} | |
local result=${result// /_} | |
local result=$(echo $result | tr '[A-Z]' '[a-z]') | |
echo "use ruby 2.0 with gemset "$result | |
rvm use ruby-2.0.0-p247@$result | |
} | |
function bootstrap_rails4(){ | |
echo "setting up ruby environment and gemset" && | |
set_ruby2_with_gemset | |
wait | |
echo "install rails 4.0.2 version, this may take a while" && | |
gem install rails -v 4.0.2 | |
wait | |
echo "initialize rails project into current dir" && | |
rails new . | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment