Created
November 22, 2017 14:46
-
-
Save joshforbes/216c318ba974bee50e4866b3c4683241 to your computer and use it in GitHub Desktop.
App setup
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/sh | |
# Set up Rails app. Run this script immediately after cloning the codebase. | |
# Exit if any subcommand fails | |
set -e | |
# Copy over configs | |
if ! [ -f .env ]; then | |
cp .env.example .env | |
# Prompt for database credentials | |
printf "Database username: " | |
read -r username | |
sed -i '' "s/username/${username}/g" .env | |
printf "Database password: " | |
read -r password | |
sed -i '' "s/password/${password}/g" .env | |
echo "Created .env file. Make sure to fill it with the right values and credentials." | |
fi | |
# Set up Ruby dependencies via Bundler | |
gem install bundler --conservative | |
bundle check || bundle install | |
# Set up database | |
bin/rails db:setup db:test:prepare | |
# Run the tests | |
bin/rspec | |
echo "Finished 👏" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment