Skip to content

Commit

Permalink
Bring in a script/setup as a reset button for the app
Browse files Browse the repository at this point in the history
  • Loading branch information
qrush committed Aug 3, 2012
1 parent 84d4e7b commit 30528a6
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions script/setup
@@ -0,0 +1,37 @@
#!/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

if [ ! -f config/database.yml ]; then
echo "Copying database.yml.example over"
cp config/database.yml.example config/database.yml
fi

# Wipe out logs and scss cache.
echo "Cleaning out old logs"
{ rm -f log/*
} >&3 2>&1

# Install dependencies
echo "Installing libraries and plugins"
{ gem list -i bundler || gem install bundler
} >&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 --trace
rake db:test:prepare --trace
} >&3 2>&1
fi

echo "Restarting Pow/Passenger"
touch tmp/restart.txt

echo "Done!"

0 comments on commit 30528a6

Please sign in to comment.