forked from sirthias/BlueForest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
updateOrDeploy.sh
executable file
·74 lines (66 loc) · 1.61 KB
/
updateOrDeploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
# updateOrDeploy.sh - updates or deploys the BlueForest.xml.
#
# Copies the BlueForest.xml from/to the current users IntelliJ config
# colors directory.
#
# Works for MacOSX, Linux and windows (using cygwin/mingw)
#
# Set "mode" environment variable to "update" to update, otherwise
# deploy is assumed.
# set up possible directory locations
export dirs
# mac locations
if [ -d ~/Library ]
then
dirs+=" $HOME/Library/Preferences/IntelliJIdea"
dirs+=" $HOME/Library/Preferences/IdeaIC"
fi
# linux locations
if [ -d ~ ]
then
dirs+=" $HOME/.IntelliJIdea"
dirs+=" $HOME/.IdeaIC"
fi
# cygwin locations
if [ ! -z $USERPROFILE ]
then
dirs+=" $USERPROFILE/.IntelliJIdea"
dirs+=" $USERPROFILE/.IdeaIC"
fi
function copy_color_file {
if [ "$mode" = "update" ]
then
echo "Copying BlueForest.xml from $1 to $PWD"
cp -i $1/BlueForest.xml .
else
echo "Copying BlueForest.xml to $1"
cp -i BlueForest.xml $1
fi
lastInstallDir=$1
}
# potential directories picked, check for different versions,
# copy to all matches, stale preference structures may exist
for version in "12" "11" "10"
do
for dirName in $dirs
do
configDir="`echo $dirName$version/config/colors`"
dir="`echo $dirName$version/colors`"
if [ -e "$configDir" ]
then
echo $configDir
copy_color_file $configDir
elif [ -e "$dir" ]
then
echo $dir
copy_color_file $dir
fi
done
done
# No IntelliJ found, exit
if [ -z $lastInstallDir ]
then
echo "IntelliJ directory was not found"
exit 1
fi