Skip to content

Commit

Permalink
Experimental deployment to eXist
Browse files Browse the repository at this point in the history
  • Loading branch information
thvitt committed Oct 4, 2019
1 parent 47cf777 commit b85b923
Showing 1 changed file with 39 additions and 2 deletions.
41 changes: 39 additions & 2 deletions build.gradle
Expand Up @@ -51,11 +51,12 @@ repositories {
// maven { url = 'http://dev.digital-humanities.de/nexus/content/groups/public' }
maven { url = 'http://dev.dariah.eu/nexus/content/groups/public' }
maven { url = 'http://maven.restlet.com' }
maven { url = 'https://raw.github.com/eXist-db/mvn-repo/master/' }
maven { url = 'https://raw.github.com/eXist-db/mvn-repo/master/' } // for < 5.0.0
}

configurations {
tools
exist
}

dependencies {
Expand All @@ -68,6 +69,10 @@ dependencies {
tools 'slimerjs:slimerjs:1.0.0@tar.bz2'
tools 'org.mozilla:firefox:59.0@tar.bz2'

// exist 'org.exist-db:exist-ant:4.4.0' // ≥ 5.0.0
exist 'org.exist-db:exist-core:4.4.0' // < 5.0.0
exist 'org.exist-db:exist-optional:4.4.0' // < 5.0.0

testCompile 'junit:junit:4.12'
}

Expand Down Expand Up @@ -123,7 +128,7 @@ task xar(type: Zip) {
dependsOn 'src:main:xproc:metadataHtml'
dependsOn 'src:main:xproc:bibliography'
dependsOn copyWeb
archiveFileName = "${existAppName}.xar" // FIXME property
archiveFileName = "${existAppName}.xar"
destinationDir = buildDir
from(project.file('src/main/xproc/exist')) {
include "*.xql"
Expand Down Expand Up @@ -156,6 +161,38 @@ task xar(type: Zip) {
}
}

task deployToExist {
dependsOn xar
inputs.file("$buildDir/${existAppName}.xar")

description 'Deploys the search app (xar) to the configured eXist instance'
group 'deploy'

doLast {
ant.taskdef(name: 'xdbStore', classname: 'org.exist.ant.XMLDBStoreTask', classpath: configurations.exist.asPath)
ant.taskdef(name: 'xdbXQuery', classname: 'org.exist.ant.XMLDBXQueryTask', classpath: configurations.exist.asPath)
ant.xdbStore(uri: "xmldb:exist://localhost:8080/exist/xmlrpc/db/upload",
user: 'admin', password: 'geheim', // FIXME before including real credentials extract to credentials plugin
createcollection: true,
srcfile: "$buildDir/${existAppName}.xar",
)
ant.xdbXQuery(uri: "xmldb:exist://localhost:8080/exist/xmlrpc/db",
user: 'admin', password: 'geheim', // FIXME before including real credentials extract to credentials plugin
outputproperty: 'existDeployResult',
query: """
try {
repo:undeploy('http://faustedition.net/exist/${existAppName}'),
repo:remove('http://faustedition.net/exist/${existAppName}')
} catch * {
'Undeployment of previous app ${existAppName} failed'
},
repo:install-and-deploy-from-db('/db/upload/${existAppName}.xar')
"""
)
logger.info(ant.existDeployResult)
}
}

assemble.dependsOn generateSVGs, copyWeb, copySource, xar


Expand Down

0 comments on commit b85b923

Please sign in to comment.