Last active
August 29, 2018 14:27
-
-
Save RenatoRosaFranco/9e561a0610bfeede2a7ef2560e95910e to your computer and use it in GitHub Desktop.
Basic rails environment pre-build
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
#!/bin/bash | |
# set your own routine here | |
prepare(){ | |
bundle install | |
if [ $1 != 'production' ]; then | |
rails db:drop RAILS_ENV=$1 | |
fi | |
rails db:create RAILS_ENV=$1 && rails db:migrate RAILS_ENV=$1 | |
rails db:seed RAILS_ENV=$1 | |
rspec; rubocop; rails_best_practices; brakeman | |
echo "environment prepapred as $1" | |
} | |
# here is rails default environments | |
# development, test, production | |
if [ $1 = 'development' ]; then | |
prepare | |
elif [ $1 = 'test' ]; then | |
prepare | |
elif [ $1 = 'production' ]; then | |
prepare | |
else | |
echo "Unknow environment" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment