-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/openmpp/main
- Loading branch information
Showing
12 changed files
with
30,501 additions
and
19,788 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# It does: | ||
# cd $OM_ROOT | ||
# # start oms in a new terminal window: | ||
# gnome-terminal -e "OM_ROOT=$PWD bin/oms -oms.Listen localhost:4040 -oms.LogRequest" | ||
# # open UI in browser: | ||
# xdg-open http://localhost:4040 | ||
# | ||
# Environment: | ||
# OM_ROOT - openM++ root folder, default is a parent dir: .. | ||
# OMS_PORT - oms web-service port to listen, default: 4040 | ||
# OM_X_TERMINAL - which x-terminal to use, default: x-terminal-emulator or gnome-terminal | ||
|
||
# set -e | ||
set -m | ||
|
||
# set openM++ root folder | ||
# | ||
self=$(basename $0) | ||
|
||
if [ -z "$OM_ROOT" ] ; | ||
then | ||
|
||
echo "Set openM++ root directory: OM_ROOT" | ||
|
||
if [ -x "${self}" ] ; | ||
then | ||
echo "pushd .." | ||
pushd .. | ||
fi | ||
|
||
OM_ROOT="$PWD" | ||
|
||
fi | ||
|
||
echo "OM_ROOT = $OM_ROOT" | ||
|
||
# check if OM_ROOT directory exist | ||
# | ||
if [ ! -d "$OM_ROOT" ] ; | ||
then | ||
echo "ERROR: openM++ directory not exist: $OM_ROOT" | ||
echo -n "Press Enter to exit..." | ||
read any | ||
exit 1 | ||
fi | ||
|
||
[ "$OM_ROOT" != "$PWD" ] && pushd $OM_ROOT | ||
|
||
export OM_ROOT="$PWD" | ||
|
||
# check if OM_ROOT is openM++ root | ||
# | ||
if [ ! -x "bin/oms" ] || [ ! -d "log" ] || [ ! -d "models/bin" ] ; | ||
then | ||
echo "ERROR: openM++ UI not found at: $OM_ROOT" | ||
echo -n "Press Enter to exit..." | ||
read any | ||
exit 1 | ||
fi | ||
|
||
# log configuration | ||
# | ||
OMPP_UI_SH_LOG="${OM_ROOT}/log/${self}.log" | ||
|
||
echo "Log: $OMPP_UI_SH_LOG" | ||
echo "OM_ROOT = $OM_ROOT" >"$OMPP_UI_SH_LOG" | ||
|
||
# which x-terminal to use: x-terminal-emulator, gnome-terminal, konsole | ||
# | ||
if [ -z "${OM_X_TERMINAL}" ] && command -v x-terminal-emulator >/dev/null 2>&1 ; | ||
then | ||
OM_X_TERMINAL="x-terminal-emulator" | ||
fi | ||
if [ -z "${OM_X_TERMINAL}" ] && command -v xfce4-terminal >/dev/null 2>&1 ; | ||
then | ||
OM_X_TERMINAL="xfce4-terminal" | ||
fi | ||
if [ -z "${OM_X_TERMINAL}" ] && command -v gnome-terminal >/dev/null 2>&1 ; | ||
then | ||
OM_X_TERMINAL="gnome-terminal" | ||
fi | ||
if [ -z "${OM_X_TERMINAL}" ] && command -v konsole >/dev/null 2>&1 ; | ||
then | ||
OM_X_TERMINAL="konsole" | ||
fi | ||
if [ -z "${OM_X_TERMINAL}" ] ; | ||
then | ||
echo "ERROR not found any of: x-terminal-emulator, gnome-terminal, konsole and OM_X_TERMINAL not set" | tee -a "$OMPP_UI_SH_LOG" | ||
echo -n "Press Enter to exit..." | ||
read any | ||
exit 1 | ||
fi | ||
|
||
# set oms port to listen | ||
# | ||
[ -z "$OMS_PORT" ] && OMS_PORT=4040 | ||
|
||
export OMS_PORT | ||
echo "OMS_PORT = $OMS_PORT" | tee -a "$OMPP_UI_SH_LOG" | ||
|
||
lsof -P -n -iTCP:"$OMS_PORT" -a -sTCP:LISTEN >>"$OMPP_UI_SH_LOG" 2>&1 | ||
if [ $? -eq 0 ] ; | ||
then | ||
echo "FAILED to start oms web-service, port in use: OMS_PORT=$OMS_PORT" | tee -a "$OMPP_UI_SH_LOG" | ||
echo "If port $OMS_PORT used by oms web-service then stop it first" | tee -a "$OMPP_UI_SH_LOG" | ||
echo -n "Press Enter to exit..." | ||
read any | ||
exit 2 | ||
fi | ||
|
||
# start oms web-service | ||
# | ||
status=0 | ||
|
||
if [ "${OM_X_TERMINAL}" != "konsole" ] ; | ||
then | ||
echo "${OM_X_TERMINAL} -e ./bin/start_oms.sh" | tee -a "$OMPP_UI_SH_LOG" | ||
|
||
${OM_X_TERMINAL} -e ./bin/start_oms.sh | ||
status=$? | ||
else | ||
echo bash -c "konsole -e ./bin/start_oms.sh &" | tee -a "$OMPP_UI_SH_LOG" | ||
|
||
bash -c "konsole -e ./bin/start_oms.sh &" | ||
status=$? | ||
fi | ||
|
||
if [ $status -ne 0 ] ; | ||
then | ||
echo "FAILED to start oms web-service using ${OM_X_TERMINAL}" | tee -a "$OMPP_UI_SH_LOG" | ||
echo -n "Press Enter to exit..." | ||
read any | ||
exit 1 | ||
fi | ||
# known issue: test above does not catch exit code of start_oms.sh | ||
|
||
# start browser and open UI | ||
# | ||
OMS_URL="http://localhost:${OMS_PORT}" | ||
|
||
echo "Open openM++ UI in browser:" | tee -a "$OMPP_UI_SH_LOG" | ||
echo "xdg-open ${OMS_URL}" | tee -a "$OMPP_UI_SH_LOG" | ||
|
||
if ! xdg-open "${OMS_URL}" >> "$OMPP_UI_SH_LOG" 2>&1; | ||
then | ||
echo "FAILED to open browser at ${OMS_URL}" | tee -a "$OMPP_UI_SH_LOG" | ||
echo -n "Press Enter to exit..." | ||
read any | ||
exit 7 | ||
fi | ||
# known issue: xdg-open may return 0 when it is not able to start browser | ||
|
||
echo "Done." | tee -a "$OMPP_UI_SH_LOG" | ||
|
||
echo -n "Press Enter to exit..." | ||
read any | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# It does: | ||
# OM_ROOT=${OM_ROOT} bin/oms -oms.Listen http://localhost:${OMS_PORT} -oms.LogRequest | ||
# | ||
# Environment: | ||
# OM_ROOT - openM++ root folder, default: current directory | ||
# OMS_PORT - oms web-service port to listen, default: 4040 | ||
|
||
# set -e | ||
set -m | ||
|
||
# set openM++ root folder | ||
# | ||
self=$(basename $0) | ||
|
||
if [ -z "$OM_ROOT" ] ; | ||
then | ||
|
||
if [ -x "${self}" ] ; | ||
then | ||
echo "pushd .." | ||
pushd .. | ||
fi | ||
|
||
OM_ROOT="$PWD" | ||
|
||
fi | ||
|
||
[ "$OM_ROOT" != "$PWD" ] && pushd $OM_ROOT | ||
|
||
# start oms web-service | ||
# | ||
[ -z "$OMS_PORT" ] && OMS_PORT=4040 | ||
|
||
echo "OM_ROOT=$OM_ROOT ./bin/oms -l localhost:${OMS_PORT} -oms.LogRequest" | ||
|
||
OM_ROOT=$OM_ROOT ./bin/oms -l localhost:${OMS_PORT} -oms.LogRequest | ||
status=$? | ||
|
||
if [ $status -ne 0 ] ; | ||
then | ||
[ $status -eq 130 ] && echo " oms web-service terminated by Ctrl+C" | ||
[ $status -ne 130 ] && echo " FAILED to start oms web-service" | ||
fi | ||
|
||
echo "." | ||
echo -n "Press Enter to exit..." | ||
read any | ||
exit $status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,26 @@ | ||
; modelOne localized messages | ||
; | ||
; message search is done by "normalized" language code: | ||
; if user language is fr_CA.UTF-8 then it is "normalized" into: fr-ca | ||
; and if default model language is EN | ||
; then search is done by following sections: fr-CA -> fr -> EN | ||
; both forms: "fr-CA" and "fr_CA.UTF-8" are "normalized" into "fr-ca" and EN into "en" | ||
; | ||
; section name and language code comparison is not case sensitive, for example: | ||
; [fr-CA] is equal to [fr-ca] | ||
; | ||
; message key comparison IS case sensitive, | ||
; for example: "Completed" is NOT the same as "completed" | ||
; and as result below two messages are different: | ||
; Completed = Terminé | ||
; completed = Terminé | ||
|
||
[en_CA] | ||
; Running Simulation = (en_CA) Running Simulation | ||
Running simulation = (en_CA) Running simulation | ||
|
||
[EN] | ||
; Running Simulation = (en) Running Simulation | ||
Running simulation = (en) Running simulation | ||
|
||
[fr-CA] | ||
; Running Simulation = (fr-CA) Running Simulation | ||
Running simulation = (fr-CA) Running simulation | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.