forked from SteamWar/SteamWar
Add a check if the template exists in the user.home directory
This commit is contained in:
@@ -66,6 +66,7 @@ class DevServer extends DefaultTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
doLast {
|
doLast {
|
||||||
|
checkHasTemplate()
|
||||||
uploadDependencies()
|
uploadDependencies()
|
||||||
startDevServer()
|
startDevServer()
|
||||||
}
|
}
|
||||||
@@ -91,6 +92,14 @@ class DevServer extends DefaultTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void checkHasTemplate() {
|
||||||
|
def process = new ProcessBuilder("ssh", host, "-T", "ls $template").start()
|
||||||
|
process.waitFor()
|
||||||
|
if (new BufferedReader(new InputStreamReader(process.inputStream)).lines().count() < 4) {
|
||||||
|
throw new GradleException("Used template is not in your user.home directory of the given host $host")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void uploadDependencies() {
|
void uploadDependencies() {
|
||||||
this.dependsOn.forEach {
|
this.dependsOn.forEach {
|
||||||
Project resolved
|
Project resolved
|
||||||
@@ -104,6 +113,7 @@ class DevServer extends DefaultTask {
|
|||||||
|
|
||||||
def archive = archiveTask.archiveFile.get().asFile
|
def archive = archiveTask.archiveFile.get().asFile
|
||||||
println("Uploading $archive to ~/$template/plugins")
|
println("Uploading $archive to ~/$template/plugins")
|
||||||
|
new ProcessBuilder("ssh", host, "-T", "rm $template/plugins/${archive.name.replace("-all", "")}").start().waitFor()
|
||||||
new ProcessBuilder("scp", archive.absolutePath, "$host:~/$template/plugins/${archive.name.replace("-all", "")}").start().waitFor()
|
new ProcessBuilder("scp", archive.absolutePath, "$host:~/$template/plugins/${archive.name.replace("-all", "")}").start().waitFor()
|
||||||
println("Uploaded $archive to ~/$template/plugins")
|
println("Uploaded $archive to ~/$template/plugins")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user