Skip to content

Instantly share code, notes, and snippets.

@joshforbes
Created November 22, 2017 14:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshforbes/216c318ba974bee50e4866b3c4683241 to your computer and use it in GitHub Desktop.
Save joshforbes/216c318ba974bee50e4866b3c4683241 to your computer and use it in GitHub Desktop.
App setup
#!/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