-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpodspec.sh
82 lines (63 loc) · 1.52 KB
/
podspec.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
78
79
80
81
82
#!/bin/sh
PODSPEC_FILE_NAME='BAError'
action=$1
RED_COLOR='\033[1;31m' #red
GREEN_COLOR='\033[1;32m' #grreen
YELOW_COLOR='\033[1;33m' #yellow
BLUE_COLOR='\033[1;34m' #blue
PINK='\033[1;35m' #pink
RES='\033[0m' #reset
ARGV_HELP="--help"
SELF_NAME="podspec.sh"
PWD_PATH=`pwd`
DIR_NAME=`dirname $0`
ROOT_PATH=${PWD_PATH}
if [[ ${DIR_NAME} != '.' ]]; then
ROOT_PATH="${PWD_PATH}/${DIR_NAME}"
fi
echo "ROOT_PATH: ${ROOT_PATH}"
func_top_help ()
{
echo "
Usage:
\t${GREEN_COLOR}sh ${SELF_NAME} <action> ${RES}${PINK}<params>${RES}
Actions:
\t${GREEN_COLOR}lint${RES}\tcheck pod validation, no need params
\t${GREEN_COLOR}push${RES}\tpublish pod, and add git tag if need"
exit 0
}
func_lint ()
{
param=$1
if [[ "${ARGV_HELP}" = "${param}" ]]; then
echo "
Usage:
\t${GREEN_COLOR}sh ${SELF_NAME} lint${RES}
\tcheck pod validation, no need params"
exit 0
fi
pod lib lint ${PODSPEC_FILE_NAME}.podspec --verbose --allow-warnings --no-clean
}
func_push ()
{
if [[ "${ARGV_HELP}" = "${param}" ]]; then
echo "
Usage:
\t${GREEN_COLOR}sh ${SELF_NAME} push ${RES}${PINK}<tag>${RES}
\tpublish pod, and add git tag if need
Params:
\t${PINK}<tag>${RES}\tavaliable, add git tag if not null"
exit 0
fi
echo "publish..."
pod trunk push ${PODSPEC_FILE_NAME}.podspec --verbose --allow-warnings
}
if [[ "$action" = "${ARGV_HELP}" ]]; then
func_top_help
elif [[ "$action" = "lint" ]]; then
func_lint
elif [[ "$action" = "push" ]]; then
func_push
else
echo "${RED_COLOR}Invalid action!${RES}\nTry --help to get more information."
fi