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