forked from rubygems/rubygems.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup
executable file
·38 lines (31 loc) · 785 Bytes
/
setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/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
bundle
} >&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!"