Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed #184 #188

Merged
merged 1 commit into from Apr 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
92 changes: 92 additions & 0 deletions examples/gradle-advanced/build.gradle
@@ -0,0 +1,92 @@
buildscript {
repositories {
jcenter()
maven {url 'http://developer.marklogic.com/maven2/'}
}
}

plugins {
id 'java'
id 'eclipse'
id 'idea'
id 'net.saliman.properties' version '1.4.5'
id 'com.marklogic.ml-data-hub-plugin' version '1.0.0-beta.1'
id 'com.marklogic.ml-gradle' version '2.1.0'
}

repositories {
jcenter()
maven {url 'http://developer.marklogic.com/maven2/'}
}

dependencies {
compile 'com.marklogic:marklogic-data-hub:+'
compile 'com.marklogic:marklogic-xcc:8.0.5'
}

ext {
// mlAppConfig is an instance of com.marklogic.appdeployer.AppConfig
mlAppConfig {
// override some default values with our values
modulesDatabaseName = mlModulesDbName
triggersDatabaseName = mlTriggersDbName
schemasDatabaseName = mlSchemasDbName
restPort = Integer.parseInt(mlStagingAppserverPort)

// Configure custom tokens for our json files
customTokens.put("%%STAGING_SERVER_NAME%%", mlStagingAppserverName)
customTokens.put("%%STAGING_SERVER_PORT%%", mlStagingAppserverPort)
customTokens.put("%%STAGING_DB_NAME%%", mlStagingDbName)

customTokens.put("%%FINAL_SERVER_NAME%%", mlFinalAppserverName)
customTokens.put("%%FINAL_SERVER_PORT%%", mlFinalAppserverPort)
customTokens.put("%%FINAL_DB_NAME%%", mlFinalDbName)

customTokens.put("%%MODULES_DB_NAME%%", mlModulesDbName)
}
}

ext {
// don't create the REST Api. We will do it manually
mlAppDeployer.commands.remove(mlAppDeployer.getCommand("DeployRestApiServersCommand"))
mlAppDeployer.commands.remove(mlAppDeployer.getCommand("UpdateRestApiServersCommand"))

// remove the original deploy content database command
// as we do not need it.
def deployDbCmd = mlAppDeployer.getCommand("DeployContentDatabasesCommand")
mlAppDeployer.commands.remove(deployDbCmd)

// install the staging database
def stagingDbCommand = new com.marklogic.appdeployer.command.databases.DeployDatabaseCommand("staging-db.json")
mlAppDeployer.commands.add(stagingDbCommand)
mlDatabaseCommands.add(0, stagingDbCommand)

// install the final database
def finalDbCommand = new com.marklogic.appdeployer.command.databases.DeployDatabaseCommand("final-db.json")
mlAppDeployer.commands.add(finalDbCommand)
mlDatabaseCommands.add(1, finalDbCommand)

// install the modules database
def modulesDbCommand = new com.marklogic.appdeployer.command.databases.DeployDatabaseCommand("modules-db.json")
mlAppDeployer.commands.add(modulesDbCommand)
mlDatabaseCommands.add(2, modulesDbCommand)

// temp workaround for ml-gradle issue #78
// https://github.com/rjrudin/ml-gradle/issues/78
def lmc = mlAppDeployer.getCommand("LoadModulesCommand")
lmc.setModulesLoader(new com.marklogic.client.modulesloader.impl.DefaultModulesLoader(mlAppConfig.newXccAssetLoader()))
}

// This task will deploy the Data Hub Modules into MarkLogic
task deployHubModules(type: com.marklogic.gradle.task.MarkLogicTask) {
description = "Call this task to deploy the MarkLogic Data Hub Modules"
doLast {
def cmd = new com.marklogic.hub.commands.LoadModulesCommand()
cmd.execute(getCommandContext())
}
}

// Set up a dependency on deployHubModules. This forces the hub
// modules to be deployed whenever you deploy your custom modules.
// This is necessary for the Hub to function properly.
mlLoadModules.dependsOn deployHubModules
16 changes: 16 additions & 0 deletions examples/gradle-advanced/gradle.properties
@@ -0,0 +1,16 @@
mlHost=localhost
mlAppName=gradle-advanced-example

mlStagingAppserverName=data-hub-STAGING
mlStagingAppserverPort=8100
mlStagingDbName=data-hub-STAGING

mlFinalAppserverName=data-hub-FINAL
mlFinalAppserverPort=8101
mlFinalDbName=data-hub-FINAL

mlModulesDbName=data-hub-MODULES
mlTriggersDbName=data-hub-TRIGGERS
mlSchemasDbName=data-hub-SCHEMAS

hubModulesPath=src/main/ml-modules/root
@@ -0,0 +1,9 @@
{
"database-name": "%%FINAL_DB_NAME%%",
"range-element-index": [],
"schema-database": "%%SCHEMAS_DATABASE%%",
"triggers-database": "%%TRIGGERS_DATABASE%%",
"triple-index": true,
"collection-lexicon": true,
"uri-lexicon": true
}
@@ -0,0 +1,5 @@
{
"database-name": "%%MODULES_DB_NAME%%",
"collection-lexicon": true,
"uri-lexicon": true
}
@@ -0,0 +1,3 @@
{
"database-name": "%%SCHEMAS_DATABASE%%"
}
@@ -0,0 +1,9 @@
{
"database-name": "%%STAGING_DB_NAME%%",
"range-element-index": [],
"schema-database": "%%SCHEMAS_DATABASE%%",
"triggers-database": "%%TRIGGERS_DATABASE%%",
"triple-index": true,
"collection-lexicon": true,
"uri-lexicon": true
}
@@ -0,0 +1,3 @@
{
"database-name": "%%TRIGGERS_DATABASE%%"
}
@@ -0,0 +1,14 @@
{
"server-name": "%%FINAL_SERVER_NAME%%",
"server-type": "http",
"root": "/",
"group-name": "%%GROUP%%",
"port": %%FINAL_SERVER_PORT%%,
"modules-database": "%%MODULES_DB_NAME%%",
"content-database": "%%FINAL_DB_NAME%%",
"authentication": "digest",
"default-error-format": "json",
"error-handler": "/MarkLogic/rest-api/error-handler.xqy",
"url-rewriter": "/MarkLogic/rest-api/rewriter.xml",
"rewrite-resolves-globally": true
}
@@ -0,0 +1,14 @@
{
"server-name": "%%STAGING_SERVER_NAME%%",
"server-type": "http",
"root": "/",
"group-name": "%%GROUP%%",
"port": %%STAGING_SERVER_PORT%%,
"modules-database": "%%MODULES_DB_NAME%%",
"content-database": "%%STAGING_DB_NAME%%",
"authentication": "digest",
"default-error-format": "json",
"error-handler": "/MarkLogic/rest-api/error-handler.xqy",
"url-rewriter": "/MarkLogic/rest-api/rewriter.xml",
"rewrite-resolves-globally": true
}
Empty file.
25 changes: 25 additions & 0 deletions examples/gradle-basic/build.gradle
@@ -0,0 +1,25 @@
buildscript {
repositories {
jcenter()
maven {url 'http://developer.marklogic.com/maven2/'}
}
}

plugins {
id 'java'
id 'eclipse'
id 'idea'
id 'net.saliman.properties' version '1.4.5'
id 'com.marklogic.ml-data-hub-plugin' version '1.0.0-beta.1'
id 'com.marklogic.ml-gradle' version '2.1.0'
}

repositories {
jcenter()
maven {url 'http://developer.marklogic.com/maven2/'}
}

dependencies {
compile 'com.marklogic:marklogic-data-hub:+'
compile 'com.marklogic:marklogic-xcc:8.0.5'
}
4 changes: 4 additions & 0 deletions examples/gradle-basic/gradle.properties
@@ -0,0 +1,4 @@
mlHost=localhost
mlStagingPort=8100
mlFinalPort=8101
hubModulesPath=./plugins