-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile.cfm
43 lines (36 loc) · 899 Bytes
/
compile.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
<cfset rootPath = getDirectoryFromPath(getCurrentTemplatePath())>
<cfdirectory
action="list"
directory="#rootPath#"
name="files"
filter="*.cfm"
recurse="true"
listinfo="name">
<cfdirectory
action="list"
directory="#rootPath#"
name="localFiles"
filter="*.cfm"
listinfo="name">
<cfquery name="files" dbtype="query">
select *
from files
where
name not in (#quotedvaluelist(localFiles.name)#)
</cfquery>
<cfset tests = {}>
<cfloop query="files">
<cfset node = tests>
<cfloop index="part" array="#listToArray(files.name,'/\')#">
<cfif find(".",part)>
<cfset node[part] = files.name>
<cfbreak>
<cfelseif not structKeyExists(node,part)>
<cfset node[part] = {}>
</cfif>
<cfset node = node[part]>
</cfloop>
</cfloop>
<cffile action="write" file="#rootPath#/tests.js" output="#serializeJSON(tests)#">
<cfcontent type="text/javascript">
{status:"success"}