rebuild-ontohub revision 6f6f5298a9d018416275e6e664bf7a8d7c40016e
93N/A#!/bin/bash
93N/A
93N/Aabort_unless_invoker_installed() {
93N/A result="$(which invoker 2>&1)"
93N/A if [[ "$?" -ne "0" ]]; then
93N/A echo ">>> Invoker not installed, please install"
93N/A exit 1
93N/A fi
93N/A}
93N/A
93N/Ainitialize_new_invoker_instance() {
93N/A result="$(invoker list 2>&1)"
93N/A if [[ "$?" -eq "0" ]]; then
93N/A echo ">>> Invoker running, restarting..."
93N/A result=`invoker stop 2>&1`
93N/A else
93N/A echo ">>> Invoker not running, starting..."
93N/A fi
93N/A invoker start invoker.ini --daemon
93N/A}
93N/A
93N/Aexecute_or_die() {
93N/A cmd="$1"
93N/A echo ">>> Executing '$cmd'"
93N/A result="$($cmd 2>&1)"
93N/A state="$?"
93N/A if [[ "$state" -ne "0" ]]; then
93N/A echo "$result"
93N/A echo ">>> Failed to execute '$cmd', aborting further commands."
285N/A exit 1
93N/A fi
93N/A}
285N/A
93N/Aabort_unless_invoker_installed
93N/Ainitialize_new_invoker_instance
93N/A
93N/Afor i in "$@"
93N/Ado
93N/Acase $i in
93N/A -d|--download-fixtures)
99N/A export DOWNLOAD_FIXTURES=true
93N/A ;;
93N/A -r|--restart)
93N/A RESTART_INVOKER_ONLY=true
93N/A ;;
285N/A *)
93N/A # unknown option
93N/A ;;
93N/A esac
93N/A shift
285N/Adone
93N/A
93N/Aif [[ !($RESTART_INVOKER_ONLY) ]]
93N/Athen
93N/A execute_or_die "bundle exec rake elasticsearch:wipe"
93N/A execute_or_die "bundle exec rake db:migrate:clean"
93N/A execute_or_die "redis-cli flushdb"
93N/A execute_or_die "bundle exec rake git:compile_cp_keys"
93N/A execute_or_die "bundle exec rake db:seed"
93N/Afi
93N/A