forked from eXist-db/demo-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
post-install.xql
26 lines (20 loc) · 1.3 KB
/
post-install.xql
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
xquery version "3.0";
import module namespace xdb="http://exist-db.org/xquery/xmldb";
import module namespace xrest="http://exquery.org/ns/restxq/exist" at "java:org.exist.extensions.exquery.restxq.impl.xquery.exist.ExistRestXqModule";
(: The following external variables are set by the repo:deploy function :)
(: the target collection into which the app is deployed :)
declare variable $target external;
(: Create 'contacts/data' collection and then make writable :)
xmldb:create-collection($target || "/examples/contacts", "data"),
sm:chmod(xs:anyURI($target || "/examples/contacts/data"), "rwxrwxrwx"),
(: Allow uploads to binary collection :)
sm:chmod(xs:anyURI($target || "/data/binary"), "rwxrwxrwx"),
(: Allow changes to addresses collection :)
sm:chmod(xs:anyURI($target || "/data/addresses"), "rwxrwxrwx"),
for $resource in xmldb:get-child-resources($target || "/data/addresses")
return
sm:chmod(xs:anyURI($target || "/data/addresses/" || $resource), "rwxrwxrwx"),
(: Register restxq modules. Should be done automatically, but there seems to be an occasional bug :)
xrest:register-module(xs:anyURI($target || "/examples/templating/restxq-demo.xql")),
xrest:register-module(xs:anyURI($target || "/examples/contacts/contacts.xql")),
xrest:register-module(xs:anyURI($target || "/examples/xforms/restxq-demo.xql"))