Commit

Author:

Hash:

Timestamp:

+21 -60 +/-3 browse

Kevin Schoon [me@kevinschoon.com]

c137783bef6e375df38e67d64d08a6e2f6405a17

Fri, 02 Feb 2024 09:06:56 +0000 (1.5 years ago)

simplify a few helper scripts
1diff --git a/scripts/compile.sh b/scripts/compile.sh
2index 2ac361d..088b896 100755
3--- a/scripts/compile.sh
4+++ b/scripts/compile.sh
5 @@ -1,26 +1,14 @@
6 #!/bin/sh
7+ set -e
8
9 COMPONENT="$1"
10
11- if [ "${COMPONENT}" = "" ] ; then
12- COMPONENT="."
13- fi
14-
15- cd "${COMPONENT}" || ( printf "Could not cd to %s\n." "${COMPONENT}"; exit 1 )
16+ IGNORE_FLAGS="-i ayllu-build/logs -i test"
17+ EXEC_FLAGS="build"
18+ SCRIPT_FLAGS="-s scripts/compile_stylesheets.sh"
19
20- if [ "${COMPONENT}" = "." ] ; then
21- cargo watch \
22- -i ayllu-build \
23- -i ayllu-xmpp \
24- -i ayllu-mail \
25- -i ayllu-spaces \
26- -i test/ \
27- -i contrib/nginx --why \
28- -s 'scripts/compile_stylesheets.sh && cargo build'
29- elif [ "${COMPONENT}" = "ayllu-build" ] ; then
30- cargo watch \
31- -i logs \
32- -s 'cargo build'
33- else
34- cargo watch -s 'cargo build'
35+ if [ -n "$COMPONENT" ] ; then
36+ PACKAGE_FLAG="--package=${COMPONENT}"
37 fi
38+
39+ cargo watch "${IGNORE_FLAGS}" "${SCRIPT_FLAGS}" "${EXEC_FLAGS}" "${PACKAGE_FLAG}"
40 diff --git a/scripts/test.sh b/scripts/test.sh
41index 4f03f55..972db85 100755
42--- a/scripts/test.sh
43+++ b/scripts/test.sh
44 @@ -1,26 +1,13 @@
45 #!/bin/sh
46+ set -e
47
48 COMPONENT="$1"
49
50- if [ "${COMPONENT}" = "" ] ; then
51- COMPONENT="."
52- fi
53-
54- cd "${COMPONENT}" || ( printf "Could not cd to %s\n." "${COMPONENT}"; exit 1 )
55+ IGNORE_FLAGS="-i ayllu-build/logs -i test"
56+ EXEC_FLAGS="test"
57
58- if [ "${COMPONENT}" = "." ] ; then
59- cargo watch \
60- -i ayllu-build \
61- -i ayllu-xmpp \
62- -i ayllu-mail \
63- -i ayllu-spaces \
64- -i test/ \
65- -i contrib/nginx --why \
66- -s 'cargo test'
67- elif [ "${COMPONENT}" = "ayllu-build" ] ; then
68- cargo watch \
69- -i logs \
70- -s 'cargo test'
71- else
72- cargo watch -s 'cargo test'
73+ if [ -n "$COMPONENT" ] ; then
74+ PACKAGE_FLAG="--package=${COMPONENT}"
75 fi
76+
77+ cargo watch "${IGNORE_FLAGS}" "${EXEC_FLAGS}" "${PACKAGE_FLAG}"
78 diff --git a/scripts/watch.sh b/scripts/watch.sh
79index 24d9916..6ed264e 100755
80--- a/scripts/watch.sh
81+++ b/scripts/watch.sh
82 @@ -1,26 +1,12 @@
83 #!/bin/sh
84+ set -e
85
86 COMPONENT="$1"
87
88- if [ "${COMPONENT}" = "" ] ; then
89- COMPONENT="."
90- fi
91-
92- cd "${COMPONENT}" || ( printf "Could not cd to %s\n." "${COMPONENT}"; exit 1 )
93+ IGNORE_FLAGS="-i ayllu-build/logs -i test"
94
95- if [ "${COMPONENT}" = "." ] ; then
96- cargo watch \
97- -i ayllu-build \
98- -i ayllu-xmpp \
99- -i ayllu-mail \
100- -i ayllu-spaces \
101- -i test/ \
102- -i contrib/nginx --why \
103- -s 'scripts/compile_stylesheets.sh && cargo run -- serve'
104- elif [ "${COMPONENT}" = "ayllu-build" ] ; then
105- cargo watch -s 'cargo run -- serve'
106- elif [ "${COMPONENT}" = "ayllu-mail" ] ; then
107- cargo watch -s 'cargo run -- serve'
108- else
109- cargo watch -x run
110+ if [ -n "$COMPONENT" ] ; then
111+ PACKAGE_FLAGS="--package=${COMPONENT}"
112 fi
113+
114+ cargo watch "${IGNORE_FLAGS}" -s "cargo run \"${PACKAGE_FLAGS}\" -- serve"