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

DEVEXP-427: Generate schemas database when running mlNewProject #665

Merged
merged 1 commit into from
Aug 29, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 7 additions & 18 deletions src/main/groovy/com/marklogic/gradle/task/NewProjectTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package com.marklogic.gradle.task

import com.marklogic.appdeployer.scaffold.ScaffoldGenerator
import com.marklogic.gradle.task.MarkLogicTask
import org.gradle.api.tasks.TaskAction

class NewProjectTask extends MarkLogicTask {
Expand All @@ -36,7 +35,7 @@ class NewProjectTask extends MarkLogicTask {
ant.input(message: "Test REST API port (intended for running automated tests; leave blank for no server):", addproperty: "mlTestRestPort")
}
ant.input(message: "Do you want support for multiple environments? ", validargs: "y,n", addproperty: "mlPropertiesPlugin", defaultvalue: "y")
ant.input(message: "Do you want resource files for a content database and set of users/roles created?", validargs: "y,n", addproperty: "mlScaffold", defaultvalue: "y")
ant.input(message: "Do you want a set of users/roles created?", validargs: "y,n", addproperty: "mlScaffoldSecurity", defaultvalue: "y")
BillFarber marked this conversation as resolved.
Show resolved Hide resolved

def now = new Date()

Expand Down Expand Up @@ -80,23 +79,13 @@ class NewProjectTask extends MarkLogicTask {
makeDirectory("src/main/ml-config")
makeDirectory("src/main/ml-modules")

if (ant.mlScaffold == "y") {
println "Writing project scaffolding files"
def appConfig = getAppConfig()
appConfig.setName(ant.mlAppName)
appConfig.setHost(ant.mlHost)
appConfig.setRestAdminUsername(ant.mlUsername)
appConfig.setRestAdminPassword(ant.mlPassword)
if (ant.mlRestPort) {
appConfig.setRestPort(Integer.parseInt(ant.mlRestPort))
if (ant.mlTestRestPort) {
appConfig.setTestRestPort(Integer.parseInt(ant.mlTestRestPort))
}
} else {
appConfig.setNoRestServer(true)
}
new ScaffoldGenerator().generateScaffold(getProject().getProjectDir().getAbsolutePath(), appConfig)
var scaffoldSecurity = (ant.mlScaffoldSecurity == "y")
var scaffoldRestServers = false
if (ant.mlRestPort) {
scaffoldRestServers = true
}
ScaffoldGenerator.AppInputs appInputs = new ScaffoldGenerator.AppInputs(ant.mlAppName, scaffoldRestServers, scaffoldSecurity)
new ScaffoldGenerator().generateScaffold(getProject().getProjectDir().getAbsolutePath(), appInputs)
}

void makeDirectory(String path) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class GenerateScaffoldTask extends MarkLogicTask {
def propName = "scaffoldPath"
def path = project.hasProperty(propName) ? project.property(propName) : getProject().getProjectDir().getAbsolutePath()
println "Generating scaffold for path: " + path
g.generateScaffold(path, getAppConfig())
ScaffoldGenerator.AppInputs appInputs = new ScaffoldGenerator.AppInputs(getAppConfig().getName())
g.generateScaffold(path, appInputs)
}
}