rebuild-ontohub revision 6547a7137a0e0204fbc3e637a688dcc8dbead2b1
#!/bin/bash
abort_unless_invoker_installed() {
result=`which invoker 2>&1`
if [[ "$?" -ne "0" ]]; then
echo ">>> Invoker not installed, please install"
exit 1
fi
}
initialize_new_invoker_instance() {
result=`invoker list 2>&1`
if [[ "$?" -eq "0" ]]; then
echo ">>> Invoker running, restarting..."
result=`invoker stop 2>&1`
else
echo ">>> Invoker not running, starting..."
fi
invoker start invoker.ini --daemon
}
execute_or_die() {
cmd="$1"
echo ">>> Executing '$cmd'"
result=`$cmd 2>&1`
state="$?"
if [[ "$state" -ne "0" ]]; then
echo "$result"
echo ">>> Failed to execute '$cmd', aborting further commands."
exit 1
fi
}
abort_unless_invoker_installed
initialize_new_invoker_instance
execute_or_die "bundle exec rake elasticsearch:wipe"
execute_or_die "bundle exec rake db:migrate:clean"
execute_or_die "redis-cli flushdb"
execute_or_die "bundle exec rake db:seed"