From 9733b8cf206f5e49db606a3d0f577e7d09cc1dd8 Mon Sep 17 00:00:00 2001 From: Ben Whitley Date: Wed, 20 May 2020 12:00:55 -0400 Subject: [PATCH 1/2] updated script to so plugin can be reloaded after an xcode update --- setup.sh | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/setup.sh b/setup.sh index c892992..71af377 100755 --- a/setup.sh +++ b/setup.sh @@ -1,15 +1,39 @@ #!/usr/bin/env bash ################### -# PLUGINS DIRECTORY +# DEFINITIONS ################### +service='Xcode' plugins_dir=~/Library/Developer/Xcode/Plug-ins/ -if [ ! -d "$plugins_dir" ]; then - mkdir -p $plugins_dir +################### +# SHUT DOWN XCODE IF IT'S RUNNING +################### + +if pgrep -xq -- "${service}"; then + echo "Xcode is running. Attempt to shut down?" + read answer + if [ "$answer" = "y" ]; then + echo "Shutting down Xcode" + pkill -x $service + else + echo "Xcode needs to be closed" + exit 1 + fi +fi + +################### + +if [ -d "${plugins_dir}Kotlin.ideplugin/" ]; then + echo "Plugins directory and Kotlin plugin found. Deleting..." + rm -rf $plugins_dir + open -a $service + pkill -x $service fi +echo "Creating plugins directory" +mkdir -p $plugins_dir cp -r Kotlin.ideplugin $plugins_dir ################### @@ -28,3 +52,4 @@ else echo $lldb_config >> ~/.lldbinit-Xcode echo $lldb_format >> ~/.lldbinit-Xcode fi + From aebb3855078a16682b8832672fcfdd652a7cdaca Mon Sep 17 00:00:00 2001 From: Ben Whitley Date: Wed, 20 May 2020 12:30:07 -0400 Subject: [PATCH 2/2] updated Xcode close question --- setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index 71af377..32cdea9 100755 --- a/setup.sh +++ b/setup.sh @@ -12,7 +12,7 @@ plugins_dir=~/Library/Developer/Xcode/Plug-ins/ ################### if pgrep -xq -- "${service}"; then - echo "Xcode is running. Attempt to shut down?" + echo "Xcode is running. Attempt to shut down? y/n" read answer if [ "$answer" = "y" ]; then echo "Shutting down Xcode"