-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.sh
executable file
·53 lines (44 loc) · 1.2 KB
/
test.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
51
52
53
#!/bin/bash
if [ -z "$TMPDIR" ]; then
TMPDIR=/tmp
fi
TESTDIR="$TMPDIR/swiftservergenerator-test"
echo "Cleaning any prior test directory $TESTDIR"
rm -rf "$TESTDIR"
echo "Creating test directory $TESTDIR"
mkdir -p "$TESTDIR"
PATH=$TESTDIR/bin:$PATH
echo "Installing swiftservergenerator"
echo "- Creating package"
npm pack
PKG=`ls swiftservergenerator-*.tgz | tail -1`
echo "- Installing package ($PKG) to test directory as global module"
npm install -g --prefix="$TESTDIR" "$PKG"
if [ "$?" != "0" ];then
echo "Failed to install"
rm -rf "$TESTDIR"
exit 1
fi
echo "Installation complete"
cd "$TESTDIR"
echo "Testing generation of default crud app"
swiftservergenerator --app --skip-build --spec '{ "appType": "crud", "appName":"test"}'
if [ "$?" != "0" ];then
echo "Failed"
rm -rf "$TESTDIR"
exit 1
fi
echo "Cleaning up generated project"
rm -rf swiftserver
echo "Testing generation of default scaffold app"
swiftservergenerator --app --skip-build --spec '{ "appType": "scaffold", "appName":"test"}'
if [ "$?" != "0" ];then
echo "Failed"
rm -rf "$TESTDIR"
exit 1
fi
echo "Cleaning up generated project"
rm -rf swiftserver
echo "Cleaning up test directory"
rm -rf $TESTDIR
echo "Testing Suceeded"