active_model_serializers/bin/serve_dummy
Benjamin Fleischer 4cc454d49b Setup benchmarking structure
- Setup dummy app files in `test/dummy`
- Setup dummy test server `bin/serve_dummy
  - Note:  Serializer caching can be completely disabled by passing in
  `CACHE_ON=off bin/serve_dummy start` since Serializer#_cache is only
  set at boot.
- run with
  - ./bin/bench
  - `bin/bench` etc adapted from ruby-bench-suite
  - target files are `test/dummy/bm_*.rb`. Just add another to run it.
  - benchmark cache/no cache
  - remove rake dependency that loads unnecessary files
- remove git gem dependency
  - Running over revisions to be added in subsequent PR
2016-03-09 12:42:25 -06:00

40 lines
696 B
Bash
Executable File

#!/usr/bin/env bash
set -e
case "$1" in
start)
config="${CONFIG_RU:-test/dummy/config.ru}"
bundle exec ruby -Ilib -S rackup "$config" --daemonize --pid tmp/dummy_app.pid --warn --server webrick
until [ -f 'tmp/dummy_app.pid' ]; do
sleep 0.1 # give it time to start.. I don't know a better way
done
cat tmp/dummy_app.pid
true
;;
stop)
if [ -f 'tmp/dummy_app.pid' ]; then
kill -TERM $(cat tmp/dummy_app.pid)
else
echo 'No pidfile'
false
fi
;;
status)
if [ -f 'tmp/dummy_app.pid' ]; then
kill -0 $(cat tmp/dummy_app.pid)
[ "$?" -eq 0 ]
else
echo 'No pidfile'
false
fi
;;
*)
echo "Usage: $0 [start|stop|status]"
;;
esac