-
Notifications
You must be signed in to change notification settings - Fork 21
/
remote.sh
77 lines (64 loc) · 1.97 KB
/
remote.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
74
75
76
77
#!/bin/bash
# 定义变量
PACKAGE="bee.template.zip"
PACKAGE_URL="https://github.com/qfish/Bee-Xcode-Template/archive/master.zip"
# PACKAGE="master.zip"
TEMPLATE_PATH="$HOME/Library/Developer/Xcode/Templates"
# TEMPLATE_PATH="./t/Templates"
BEEFRAMEWORK="BeeFramework"
TEMPLATE_FILE="File Templates"
TEMPLATE_PROJECT="Project Templates"
TEMPLATE_FILE_PATH="$TEMPLATE_PATH/$TEMPLATE_FILE"
TEMPLATE_PROJECT_PATH="$TEMPLATE_PATH/$TEMPLATE_PROJECT"
SOURCE_TEMPLATE="Bee-Xcode-Template-master/Templates"
SOURCE_TEMPLATE_FILE="$SOURCE_TEMPLATE/$TEMPLATE_FILE/$BEEFRAMEWORK"
SOURCE_TEMPLATE_PROJECT="$SOURCE_TEMPLATE/$TEMPLATE_PROJECT/$BEEFRAMEWORK"
# # 如果已有,先删除上一个版本的
if [ -d "$TEMPLATE_FILE_PATH/$BEEFRAMEWORK" ]; then
sudo rm -rf "$TEMPLATE_FILE_PATH/$BEEFRAMEWORK"
echo "remove $TEMPLATE_FILE_PATH/$BEEFRAMEWORK"
fi
if [ -d "$TEMPLATE_PROJECT_PATH/$BEEFRAMEWORK" ]; then
sudo rm -rf "$TEMPLATE_PROJECT_PATH/$BEEFRAMEWORK"
echo "remove $TEMPLATE_PROJECT_PATH/$BEEFRAMEWORK"
fi
# # 从网络下载
if [[ ! -f "$PACKAGE" ]]; then
status=$(sudo curl -L "$PACKAGE_URL" -o "$PACKAGE")
fi
# 解压
echo "unzip package ..."
sudo tar xzf "$PACKAGE"
# 复制
echo "
//
// ______ ______ ______
// /\ __ \ /\ ___\ /\ ___\
// \ \ __< \ \ __\_ \ \ __\_
// \ \_____\ \ \_____\ \ \_____\
// \/_____/ \/_____/ \/_____/
//
//
// Copyright (c) 2013-2014, {Bee} open source community
// http://www.bee-framework.com
//
//
// Xcode Template For BeeFramework
//
"
if [[ ! -d "$TEMPLATE_FILE_PATH" ]]; then
sudo mkdir -p "$TEMPLATE_FILE_PATH"
echo "$TEMPLATE_FILE_PATH"
fi
sudo cp -rf "$SOURCE_TEMPLATE_FILE" "$TEMPLATE_FILE_PATH"
if [[ ! -d "$TEMPLATE_PROJECT_PATH" ]]; then
sudo mkdir -p "$TEMPLATE_PROJECT_PATH"
echo "$TEMPLATE_PROJECT_PATH"
fi
sudo cp -rf "$SOURCE_TEMPLATE_PROJECT" "$TEMPLATE_PROJECT_PATH"
# cleanup
# sudo rm -rf "$PACKAGE"
sudo rm -rf "Bee-Xcode-Template-master"
echo "
# Bee Xcode Template is installed to $TEMPLATE_PATH.
# "