forked from SteamWar/SteamWar
Add steamwar.properties 'worldName' and 'host'
Remove some options
This commit is contained in:
@@ -32,20 +32,30 @@ class DevServer extends DefaultTask {
|
||||
@Optional
|
||||
Integer port = null
|
||||
|
||||
@Input
|
||||
@Optional
|
||||
Boolean profile = false
|
||||
|
||||
@Input
|
||||
@Optional
|
||||
Boolean forceUpgrade = false
|
||||
|
||||
@Input
|
||||
@Optional
|
||||
String jar = null
|
||||
|
||||
DevServer() {
|
||||
super()
|
||||
doFirst {
|
||||
List<Project> projects = []
|
||||
projects.add(project)
|
||||
while (projects.first.parent != null) {
|
||||
projects.add(0, projects.first.parent)
|
||||
}
|
||||
|
||||
def properties = new Properties()
|
||||
projects.forEach {
|
||||
def file = new File(it.projectDir, "steamwar.properties")
|
||||
if (file.exists()) {
|
||||
properties.load(new FileInputStream(file))
|
||||
}
|
||||
}
|
||||
|
||||
if (worldName == null) worldName = properties.get("worldName")
|
||||
host = properties.get("host")
|
||||
}
|
||||
doLast {
|
||||
uploadDependencies()
|
||||
startDevServer()
|
||||
@@ -54,7 +64,10 @@ class DevServer extends DefaultTask {
|
||||
}
|
||||
|
||||
@Internal
|
||||
BufferedWriter processInput;
|
||||
BufferedWriter processInput
|
||||
|
||||
@Internal
|
||||
String host
|
||||
|
||||
class Finalizer extends DefaultTask {
|
||||
|
||||
@@ -82,14 +95,14 @@ class DevServer extends DefaultTask {
|
||||
|
||||
def archive = archiveTask.archiveFile.get().asFile
|
||||
println("Uploading $archive to ~/plugins/${template}")
|
||||
new ProcessBuilder("scp", archive.absolutePath, "sw:~/plugins/$template/${archive.name.replace("-all", "")}").start().waitFor()
|
||||
new ProcessBuilder("scp", archive.absolutePath, "$host:~/plugins/$template/${archive.name.replace("-all", "")}").start().waitFor()
|
||||
println("Uploaded $archive to ~/plugins/${template}")
|
||||
}
|
||||
}
|
||||
|
||||
void startDevServer() {
|
||||
def devPy = new StringBuilder()
|
||||
if (template.endsWith("Velocity")) {
|
||||
if (template.endsWith("Velocity")) { // TODO Add this to the dev.py!
|
||||
devPy.append("cd DevVelocity")
|
||||
devPy.append("; java -jar Velocity.jar --port 25566")
|
||||
} else {
|
||||
@@ -97,14 +110,12 @@ class DevServer extends DefaultTask {
|
||||
if (port != null) devPy.append(" --port $port")
|
||||
if (worldName != null) devPy.append(" -w $worldName")
|
||||
devPy.append(" -p plugins/$template")
|
||||
if (profile) devPy.append(" --profile")
|
||||
if (forceUpgrade) devPy.append(" --forceUpgrade")
|
||||
if (jar != null) devPy.append(" --jar $jar")
|
||||
println("Starting $template with command ${devPy.toString()}")
|
||||
devPy.append(" $template")
|
||||
}
|
||||
|
||||
def process = new ProcessBuilder("ssh", "sw", "-T", devPy.toString()).start();
|
||||
def process = new ProcessBuilder("ssh", host, "-T", devPy.toString()).start();
|
||||
def running = true;
|
||||
def processOutput = new BufferedReader(new InputStreamReader(process.inputStream))
|
||||
new Thread({
|
||||
|
||||
Reference in New Issue
Block a user