-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmake_mongrel.sh
More file actions
executable file
·72 lines (61 loc) · 1.62 KB
/
make_mongrel.sh
File metadata and controls
executable file
·72 lines (61 loc) · 1.62 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#! /bin/bash
VERSION=1.3.0
LIB_NAME=mongrel
BUILD_NAME=$LIB_NAME-$VERSION
make_failed()
{
rm -r $BUILD_NAME
echo $1
exit 1
}
# If an archive already exists, delete it.
if ls $LIB_NAME-*.zip >/dev/null 2>/dev/null
then
rm $LIB_NAME-*.zip
fi
# Create directories for the build artifacts.
mkdir $BUILD_NAME
mkdir $BUILD_NAME/doc
mkdir $BUILD_NAME/ebin
mkdir $BUILD_NAME/tbin
# Compile the source and the tests to separate binary directories.
echo "Compiling..."
if ! erlc -I include -o $BUILD_NAME/ebin src/*.erl
then
make_failed "Compilation failed."
fi
cp src/$LIB_NAME.app.src $BUILD_NAME/ebin/$LIB_NAME.app
if ! erlc -I include -o $BUILD_NAME/tbin test/*.erl
then
make_failed "Tests couldn't be compiled."
fi
# Run all the tests.
echo "Running tests..."
if ! erl -noshell -pa $BUILD_NAME/ebin -pa $BUILD_NAME/tbin -s test_all test $BUILD_NAME/tbin -s init stop
then
make_failed "Not all tests passed."
fi
# We don't need to keep the test binaries.
rm -r $BUILD_NAME/tbin
# Create the EDocs.
echo "Generating EDocs..."
cp doc/overview.edoc $BUILD_NAME/doc
if ! ./gen_doc.sh $BUILD_NAME/doc
then
make_failed "Errors while generating EDocs."
fi
# Copy source files into the artifacts directory.
rsync -p -r --exclude=".*" src $BUILD_NAME
rsync -p -r --exclude=".*" test $BUILD_NAME
rsync -p -r --exclude=".*" include $BUILD_NAME
rsync -p -r --exclude=".*" src_examples $BUILD_NAME
cp make_mongrel.sh $BUILD_NAME
cp gen_doc.sh $BUILD_NAME
cp releases.txt $BUILD_NAME
# Zip it all up.
echo "Packaging..."
zip -q $BUILD_NAME.zip -r $BUILD_NAME
#tar cjf $BUILD_NAME.tar.gz $BUILD_NAME
rm -r $BUILD_NAME
echo "OK."
exit 0