Created
March 17, 2012 08:58
-
-
Save nikhgupta/2056853 to your computer and use it in GitHub Desktop.
a bash function to create a new rails project with some defaults
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
# note that the database is being used with login: root/password | |
# make necessary changes if you are using something else or simple remove that block | |
function newrails() { | |
app="$1"; ruby="${2:-1.9.3@rails}"; | |
if [ -n "${app}" ]; then | |
read -r -d '' gemfile <<-'EOF' | |
group :test, :development do | |
gem 'turn' | |
gem 'rspec-rails' | |
gem 'capybara' | |
gem 'guard-rspec' | |
gem 'ruby_gntp' | |
gem 'minitest' | |
gem 'launchy' | |
end | |
EOF | |
rvm use "${ruby}" && | |
rails new "${app}" -T -d mysql -j jquery && | |
cd "${app}" && | |
git init && | |
git add . && | |
git commit -qm "Initial Commit. Generated a fresh new rails app" && | |
rvm use "${ruby}" --rvmrc && | |
echo "${gemfile}" >> Gemfile && | |
bundle install && | |
rails generate rspec:install && | |
guard init rspec && | |
# rails generate jquery:install && | |
sed -i '' -e 's/password:.*/password: password/g' config/database.yml && | |
git add . && | |
git commit -qm "Made some default initial changes to the application" && | |
rake db:create | |
echo "Created a new Rails Project with jQuery, MySQL and no testing framework." | |
else | |
echo "You must provide an application name." | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment