-
Notifications
You must be signed in to change notification settings - Fork 3
/
jsongen.cfm
92 lines (59 loc) · 1.83 KB
/
jsongen.cfm
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
<cfscript>
param name="url.exportPath" default="#expandPath("/export")#";
sep = SERVER.separator.file;
version= SERVER.lucee.version;
versioninfo = {
'loaderVersion' : SERVER.lucee.loaderVersion,
'release-date' : SERVER.lucee['release-date'],
'state' : SERVER.lucee.state,
'version' : SERVER.lucee.version,
'versionName' : SERVER.lucee.versionName,
'versionNameExplanation' : SERVER.lucee.versionNameExplanation,
}
ExportPath = "#url.exportPath##sep##version#";
JSONDocsPath = ExportPath & "#sep#json";
TagsPath = JSONDocsPath & "#sep#tags";
FuncsPath = JSONDocsPath & "#sep#functions";
//Clean it first
checkPath(JSONDocsPath);
checkPath(TagsPath);
checkPath(FuncsPath);
function checkPath(path){
if(!directoryExists(path)){
directoryCreate(path);
}
directoryClear(path);
}
function DirectoryClear(path){
var items =directoryList(path, false, "query");
for(item in items){
if(item.type IS "File"){
var itemPath= item.directory & sep & item.name;
fileDelete(itemPath);
}
}
}
funclist = [];
taglist = [];
for(fun in getFunctionList()){
funclist.append(fun);
fundata = getFunctionData(fun);
funcPath = FuncsPath & "#sep##fun#.json";
fileWrite(funcPath,SerializeJSON(fundata));
}
arraySort(funclist, "textnocase", "ASC");
FileWrite(JSONDocsPath & "#sep#functions.json", SerializeJSON(funclist));
ignorelist = "_";
for(tag in getTagList().cf){
if(listFindNoCase(ignorelist, tag)){
continue;
}
taglist.append("cf" & tag);
tagData = getTagData("cf", tag);
tagPath = TagsPath & "#sep#cf#tag#.json";
fileWrite(tagPath,SerializeJSON(tagData));
}
arraySort(taglist, "textnocase", "ASC");
FileWrite(JSONDocsPath & "#sep#tags.json", SerializeJSON(taglist));
FileWrite(JSONDocsPath & "#sep#version.json", SerializeJSON(versioninfo));
</cfscript>