Skip to content

Commit c957411

Browse files
committed
Setup dummy test server [ci skip]
Note: Serializer caching can be completely disabled by passing in `CACHE_ON=off bin/server_dummy start` since Serializer#_cache is only set at boot.
1 parent 2f225b1 commit c957411

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

bin/serve_dummy

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
case "$1" in
5+
6+
start)
7+
config="${CONFIG_RU:-test/dummy/config.ru}"
8+
bundle exec ruby -Ilib -S rackup "$config" --daemonize --pid tmp/dummy_app.pid --warn --server webrick
9+
until [ -f 'tmp/dummy_app.pid' ]; do
10+
sleep 0.1 # give it time to start.. I don't know a better way
11+
done
12+
cat tmp/dummy_app.pid
13+
true
14+
;;
15+
16+
stop)
17+
if [ -f 'tmp/dummy_app.pid' ]; then
18+
kill -TERM $(cat tmp/dummy_app.pid)
19+
else
20+
echo 'No pidfile'
21+
false
22+
fi
23+
;;
24+
25+
status)
26+
if [ -f 'tmp/dummy_app.pid' ]; then
27+
kill -0 $(cat tmp/dummy_app.pid)
28+
[ "$?" -eq 0 ]
29+
else
30+
echo 'No pidfile'
31+
false
32+
fi
33+
;;
34+
35+
*)
36+
echo "Usage: $0 [start|stop|status]"
37+
;;
38+
39+
esac

0 commit comments

Comments
 (0)