forked from propelorm/Propel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreset_tests.sh
executable file
·50 lines (38 loc) · 1.03 KB
/
reset_tests.sh
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
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
# Reset Propel tests fixtures
# 2011 - William Durand <[email protected]>
CURRENT=`pwd`
function rebuild
{
local dir=$1
echo "[ $dir ]"
if [ -d "$dir/build" ] ; then
rm -rf "$dir/build"
fi
$ROOT/generator/bin/propel-gen $FIXTURES_DIR/$dir main > /dev/null
$ROOT/generator/bin/propel-gen $FIXTURES_DIR/$dir insert-sql > /dev/null
}
ROOT_DIR=""
FIXTURES_DIR=""
if [ -d "$CURRENT/fixtures" ] ; then
ROOT=".."
FIXTURES_DIR="$CURRENT/fixtures"
elif [ -d "$CURRENT/test/fixtures" ] ; then
ROOT="."
FIXTURES_DIR="$CURRENT/test/fixtures"
else
echo "ERROR: No 'test/fixtures/' directory found !"
exit 1
fi
DIRS=`ls $FIXTURES_DIR`
for dir in $DIRS ; do
rebuild $dir
done
# Special case for reverse fixtures
REVERSE_DIRS=`ls $FIXTURES_DIR/reverse`
for dir in $REVERSE_DIRS ; do
if [ -f "$FIXTURES_DIR/reverse/$dir/build.properties" ] ; then
echo "[ $dir ]"
$ROOT/generator/bin/propel-gen $FIXTURES_DIR/reverse/$dir insert-sql > /dev/null
fi
done