-
Notifications
You must be signed in to change notification settings - Fork 6
/
one_key_install
executable file
·51 lines (39 loc) · 1.34 KB
/
one_key_install
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
# 切换文件夹
cd `dirname $0`
pwd
# 添加.clang-format文件
if [ ! -f ~/.clang-format ]; then
cp .clang-format ~
else
echo 'clang-format配置文件已存在'
fi
# PlistBuddy添加Xcode的UUID
xcode_uuid=`defaults read /Applications/Xcode.app/Contents/Info.plist DVTPlugInCompatibilityUUID`
search_in_plist=`/usr/libexec/PlistBuddy -c "Print :DVTPlugInCompatibilityUUIDs:" ./ZZClang-format/Info.plist | grep $xcode_uuid`
if [ ${#search_in_plist} == 0 ];then
echo "不存在Xcode的uuid:$xcode_uuid,自动添加"
/usr/libexec/PlistBuddy -c "Add :DVTPlugInCompatibilityUUIDs: string $xcode_uuid" ./ZZClang-format/Info.plist
else
echo "已存在xcode_uuid:$xcode_uuid"
fi
# 编译ZZClang
xcodebuild -scheme ZZClang-format -configuration Release
# 查看gem源,并更改为https://gems.ruby-china.com/
your_gem_source=`gem sources -l | grep https://gems.ruby-china.com`
echo "your_gem_source:$your_gem_source"
if [ -z $your_gem_source ]; then
echo '貌似你的gem源过期了'
gem sources --add https://gems.ruby-china.com/
else
echo 'gem正常'
fi
# 允许Xcode插件
if command -v update_xcode_plugins > /dev/null; then
echo "update_xcode_plugins has found"
else
echo "update_xcode_plugins has not found"
# 安装
sudo gem install -n /usr/local/bin update_xcode_plugins
fi
update_xcode_plugins
update_xcode_plugins --unsign