forked from fegos/fego-rn-update
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appledoc2html.sh
executable file
·111 lines (100 loc) · 2.15 KB
/
appledoc2html.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
#脚本说明:把工程里的文件生成文档
#参数说明:
#-n:companyName
#-p:projectPath
#-d:companyID
#-u:companyURL
#-t:target
#-o:outputPath
#if [ $# -lt 1 ];then
# echo "Error! There's no param!"
# exit 1
#fi
companyName="fego";
companyID="fego";
companyURL="http://fe.hhtcex.com";
os="iphoneos";
projectPath="./ios";
outputPath="./docs/ios";
target="fego-rn-update";
#os="macosx";
while getopts "n:p:d:u:t:o:" arg
do
case $arg in
n)
companyName=$OPTARG #公司名称
;;
p)
projectPath=$OPTARG #项目路径
;;
d)
companyID=$OPTARG #项目id
;;
u)
companyURL=$OPTARG #公司URL地址
;;
t)
target=$OPTARG #项目target name
;;
o)
outputPath=$OPTARG #文档的输出路径
;;
"?")
echo "Error! Unknown option $OPTARG"
exit 2
;;
":")
echo "Error! No argument value for option $OPTARG"
exit 2
;;
*)
# Should not occur
echo "Error! Unknown error while processing options"
exit 2
;;
esac
done
# 判断工程路径是否传入
if [ "$projectPath" == "" ];then
echo '(-p):project path must not null!'
exit 1
fi
# 判断工程路径是否是正确
if [ ! -d $projectPath ];then
echo "-p param must be a directory."
exit 2
fi
# 判断target是否传入
if [ "$target" == "" ];then
echo '(-t):target name must not null!'
exit 1
fi
# 判断输出路径是否传入
if [ "$outputPath" == "" ];then
outputPath=$projectPath/help
fi
# 判断URL是否传入
docset_feed_url=$companyName
if [ "$companyURL" != "" ];then
docset_feed_url=$companyURL/$companyName
fi
# End constants
/usr/local/bin/appledoc \
--project-name "${target}" \
--project-company "${companyName}" \
--company-id "${companyID}" \
--docset-atom-filename "${companyName}.atom" \
--docset-feed-url "${docset_feed_url}/%DOCSETATOMFILENAME" \
--docset-package-url "${docset_feed_url}/%DOCSETPACKAGEFILENAME" \
--docset-fallback-url "${docset_feed_url}" \
--output "${outputPath}" \
--publish-docset \
--docset-platform-family "${os}" \
--logformat xcode \
--keep-intermediate-files \
--no-repeat-first-par \
--no-warn-invalid-crossref \
--exit-threshold 2 \
"${projectPath}"
echo 'doc output path:'$outputPath