Skip to content

Commit 08fd41b

Browse files
author
Ben Whitley
authored
Merge pull request #20 from touchlab/bw/XcodeUpdateScript
updated script to so plugin can be reloaded after an xcode update
2 parents 14f8d68 + aebb385 commit 08fd41b

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

setup.sh

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,39 @@
11
#!/usr/bin/env bash
22

33
###################
4-
# PLUGINS DIRECTORY
4+
# DEFINITIONS
55
###################
66

7+
service='Xcode'
78
plugins_dir=~/Library/Developer/Xcode/Plug-ins/
89

9-
if [ ! -d "$plugins_dir" ]; then
10-
mkdir -p $plugins_dir
10+
###################
11+
# SHUT DOWN XCODE IF IT'S RUNNING
12+
###################
13+
14+
if pgrep -xq -- "${service}"; then
15+
echo "Xcode is running. Attempt to shut down? y/n"
16+
read answer
17+
if [ "$answer" = "y" ]; then
18+
echo "Shutting down Xcode"
19+
pkill -x $service
20+
else
21+
echo "Xcode needs to be closed"
22+
exit 1
23+
fi
24+
fi
25+
26+
###################
27+
28+
if [ -d "${plugins_dir}Kotlin.ideplugin/" ]; then
29+
echo "Plugins directory and Kotlin plugin found. Deleting..."
30+
rm -rf $plugins_dir
31+
open -a $service
32+
pkill -x $service
1133
fi
1234

35+
echo "Creating plugins directory"
36+
mkdir -p $plugins_dir
1337
cp -r Kotlin.ideplugin $plugins_dir
1438

1539
###################
@@ -28,3 +52,4 @@ else
2852
echo $lldb_config >> ~/.lldbinit-Xcode
2953
echo $lldb_format >> ~/.lldbinit-Xcode
3054
fi
55+

0 commit comments

Comments
 (0)