Skip to content
Snippets Groups Projects
Commit a15d04a8 authored by Simon Oehrl's avatar Simon Oehrl
Browse files

Make plugin system more flexible

parent c29e5554
No related branches found
No related tags found
No related merge requests found
......@@ -55,79 +55,51 @@ function initial_setup() {
}
function manage_plugins() {
plugins=(
"likert scale plugin"
"Logging Plugin"
"nDisplayExtensions"
"NDisplay Launch Button"
"UniversalLogging"
"Unreal Cave Overlay"
"Unreal-Study-Framework"
"Unreal VA Plugin"
"UnrealVisPlugin"
"Widget Interaction Plugin"
)
plugin_repositories=(
"https://devhub.vr.rwth-aachen.de/VR-Group/unreal-development/likert-scale-plugin.git"
"https://devhub.vr.rwth-aachen.de/VR-Group/unreal-development/logging-plugin.git"
"https://devhub.vr.rwth-aachen.de/VR-Group/unreal-development/ndisplayextensions.git"
"https://devhub.vr.rwth-aachen.de/VR-Group/unreal-development/NDisplayLaunchButton.git"
"https://devhub.vr.rwth-aachen.de/VR-Group/unreal-development/universallogging.git"
"https://devhub.vr.rwth-aachen.de/VR-Group/unreal-development/unreal-cave-overlay.git"
"https://devhub.vr.rwth-aachen.de/VR-Group/unreal-development/unreal-study-framework.git"
"https://devhub.vr.rwth-aachen.de/VR-Group/unreal-development/unreal-va-plugin.git"
"https://devhub.vr.rwth-aachen.de/VR-Group/unreal-development/unrealvisplugin.git"
"https://devhub.vr.rwth-aachen.de/VR-Group/unreal-development/widgetinteraction.git"
)
if [ "$1" == "initial_setup" ]
then
plugin_branches=(
""
""
"master"
""
""
"master"
""
""
""
""
)
else
plugin_branches=(
""
""
""
""
""
""
""
""
""
""
)
SAVEIFS=$IFS
IFS=$'\n'
plugin_list=($(git config -f Plugins/UnrealPlugins/plugins.config --name-only --get-regexp ".*.name"))
IFS=$SAVEIFS
for i in ${!plugins[@]}
declare -a plugin_ids
declare -a plugins
declare -a plugin_repositories
declare -a plugin_branches
for i in ${!plugin_list[@]}
do
repo_name_with_extension=${plugin_repositories[$i]##*/}
repo_name=${repo_name_with_extension%*.git}
plugin_id=${plugin_list[$i]%.name}
plugin_ids+=("$plugin_id")
plugin_name=$(git config -f Plugins/UnrealPlugins/plugins.config --get "$plugin_id.name")
plugins+=("${plugin_name}")
plugin_repositories+=($(git config -f Plugins/UnrealPlugins/plugins.config --get "$plugin_id.url"))
path=$(git config -f .gitmodules --get "submodule.Plugins/${repo_name}.path")
if [ "$1" == "initial_setup" ]
then
branch=($(git config -f Plugins/UnrealPlugins/plugins.config --get "$plugin_id.default-branch"))
if [ $? == 0 ]
then
plugin_branches+=("$branch")
else
plugin_branches+=("")
fi
else
path=$(git config -f .gitmodules --get "submodule.Plugins/${plugin_id}.path")
if [ $? == 0 ]
then
branch=$(git config -f .gitmodules --get "submodule.Plugins/${repo_name}.branch")
branch=$(git config -f .gitmodules --get "submodule.Plugins/${plugin_id}.branch")
if [ $? -ne 0 ]
then
plugin_branches[$i]="master"
plugin_branches+=("master")
else
plugin_branches[$i]="$branch"
plugin_branches+=("$branch")
fi
else
plugin_branches+=("")
fi
done
fi
done
function toggle_branch() {
case ${plugin_branches[$1]} in
......@@ -178,6 +150,7 @@ function manage_plugins() {
echo "[Enter] Continue"
echo "[Esc] Cancel"
SAVEIFS=$IFS
IFS=''
escape_char=$(printf "\u1b")
escape=false
......@@ -186,6 +159,7 @@ function manage_plugins() {
escape=true
read -rsn2 -t 0.1 mode # read 2 more chars
fi
IFS=$SAVEIFS
case $mode in
"") if [ "$escape" == true ]; then cancel=true; fi; exit=true ;;
" ") toggle_branch $selection ;;
......@@ -193,6 +167,7 @@ function manage_plugins() {
"[B") if [ "$selection" -lt "$num_plugins_minus_one" ]; then let selection+=1; fi ;;
*) >&2 ;;
esac
done
if [ "$cancel" != true ]
......@@ -204,9 +179,7 @@ function manage_plugins() {
for i in ${!plugins[@]}
do
# Check if plugin is already present
repo_name_with_extension=${plugin_repositories[$i]##*/}
repo_name=${repo_name_with_extension%*.git}
path=$(git config -f .gitmodules --get "submodule.Plugins/${repo_name}.path")
path=$(git config -f .gitmodules --get "submodule.Plugins/${plugin_ids[$i]}.path")
if [ $? -ne 0 ]
then
plugin_present=false
......@@ -226,7 +199,7 @@ function manage_plugins() {
else
# Updating existing plugin
echo "Update plugin: ${plugins[$i]}"
cd Plugins/$repo_name
cd "Plugins/${plugin_ids[$i]}"
git fetch
git checkout ${plugin_branches[$i]}
git pull
......@@ -236,7 +209,7 @@ function manage_plugins() {
if [ "$plugin_present" == true ]
then
# Remove plugin!
git rm -f "Plugins/$repo_name"
git rm -f "Plugins/${plugin_ids[$i]}"
fi
fi
done
......@@ -281,6 +254,7 @@ function show_main_menu() {
echo "[Enter] Select"
echo "[Esc] Quit"
SAVEIFS=$IFS
IFS=''
escape_char=$(printf "\u1b")
escape=false
......@@ -289,6 +263,7 @@ function show_main_menu() {
escape=true
read -rsn2 -t 0.1 mode # read 2 more chars
fi
IFS=$SAVEIFS
case $mode in
"") if [ "$escape" = true ]; then quit=true; fi; exit=true ;;
"[A") if [ "$selection" -gt "0" ]; then let selection-=1; fi ;;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment