Created
May 10, 2012 08:40
-
-
Save joelmoss/2651918 to your computer and use it in GitHub Desktop.
Short setup script for rails projects
This file contains hidden or 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 -e | |
| export PATH="$(dirname "$0")/../bin:$PATH" # Use binstubs | |
| if [ "$1" = "-v" ]; then | |
| exec 3>&1 | |
| else | |
| exec 3>/dev/null | |
| fi | |
| # Wipe out logs and scss cache. | |
| echo "Cleaning out old logs and tempfiles" | |
| { rm -f log/* | |
| rm -rf tmp/cache | |
| } >&3 2>&1 | |
| # Install dependencies | |
| echo "Installing libraries and plugins" | |
| { gem list -i bundler || gem install bundler && rbenv rehash | |
| bundle install && rbenv rehash | |
| } >&3 2>&1 | |
| # Wipe and load the database unless KEEPDB=1 env var is set. | |
| if [ -z "$KEEPDB" ]; then | |
| echo "Reloading the database" | |
| { rake db:create:all db:drop:all db:setup db:fixtures:load --trace | |
| rake db:test:prepare --trace | |
| } >&3 2>&1 | |
| fi | |
| echo "Restarting Pow" | |
| touch tmp/restart.txt | |
| echo "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment