-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathBuild.cfc
60 lines (55 loc) · 1.79 KB
/
Build.cfc
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
<cfcomponent output="false">
<cffunction name="init" output="false">
<cfset variables.adminType = "web" />
<cfparam name="cfadminpassword" default="${cfadmin.password}" />
<cfparam name="secure" default="false" />
<cfset variables["password#variables.adminType#"] = cfadminpassword />
<cfreturn this />
</cffunction>
<cffunction name="compile-mapping" access="remote" output="false">
<cfargument name="mapping" required="true">
<cfsilent>
<cfset init() />
<cftry>
<cfadmin
action="compileMapping"
type="web"
password="#variables["password"&variables.adminType]#"
virtual="#arguments.mapping#"
stoponerror="false"
/>
<cfreturn "compiled mapping: #arguments.mapping#" />
<cfcatch>
<cfreturn cfcatch.message & cfcatch.detail />
</cfcatch>
</cftry>
</cfsilent>
</cffunction>
<cffunction name="compile-archive" access="remote" output="false">
<cfargument name="mapping" required="true">
<cfargument name="toFile" required="true">
<cfset init() />
<cftry>
<cfadmin
action="createArchive"
type="web"
password="#variables["password"&variables.adminType]#"
file="#arguments.toFile#"
virtual="#arguments.mapping#"
secure="#secure#"
stoponerror="false"
append="false"
/>
<cfreturn "compiled archive: #arguments.mapping# : #arguments.toFile#" />
<cfcatch>
<cfreturn cfcatch.message & cfcatch.detail />
</cfcatch>
</cftry>
</cffunction>
<cffunction name="show-results" access="remote" output="false">
<cfargument name="resultsFile" required="true">
<cffile action="read" file="#resultsFile#" variable="results" />
<cfset writeOutput("compiled archive: #paragraphFormat(results)#")/>
<cfheader statuscode="200" />
</cffunction>
</cfcomponent>