mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-13 07:32:13 +00:00
Backport updates to TarUpload for easier uploading of docs to website.
This commit is contained in:
parent
5c597c8cde
commit
80fd238c3a
@ -10,12 +10,23 @@ import org.gradle.api.tasks.bundling.Compression;
|
|||||||
class TarUpload extends Tar {
|
class TarUpload extends Tar {
|
||||||
@Input
|
@Input
|
||||||
String remoteDir
|
String remoteDir
|
||||||
|
|
||||||
@Input
|
|
||||||
Login login
|
Login login
|
||||||
|
@Input
|
||||||
|
String host
|
||||||
|
|
||||||
TarUpload() {
|
TarUpload() {
|
||||||
compression = Compression.BZIP2
|
compression = Compression.BZIP2
|
||||||
|
if (project.configurations.findByName('antjsch') == null) {
|
||||||
|
project.configurations.add('antjsch')
|
||||||
|
project.dependencies {
|
||||||
|
antjsch 'org.apache.ant:ant-jsch:1.8.1'
|
||||||
|
}
|
||||||
|
def classpath = project.configurations.antjsch.asPath
|
||||||
|
project.ant {
|
||||||
|
taskdef(name: 'scp', classname: 'org.apache.tools.ant.taskdefs.optional.ssh.Scp', classpath: classpath)
|
||||||
|
taskdef(name: 'sshexec', classname: 'org.apache.tools.ant.taskdefs.optional.ssh.SSHExec', classpath: classpath)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TaskAction
|
@TaskAction
|
||||||
@ -38,6 +49,7 @@ class TarUpload extends Tar {
|
|||||||
void setLogin(Login login) {
|
void setLogin(Login login) {
|
||||||
dependsOn(login)
|
dependsOn(login)
|
||||||
this.login = login
|
this.login = login
|
||||||
|
this.host = login.host
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,11 +64,12 @@ class Login extends DefaultTask {
|
|||||||
|
|
||||||
@TaskAction
|
@TaskAction
|
||||||
login() {
|
login() {
|
||||||
project.ant {
|
def console = System.console()
|
||||||
input("Please enter the ssh username for host '$host'", addproperty: "user.$host")
|
if (console) {
|
||||||
input("Please enter the ssh password '$host'", addproperty: "pass.$host")
|
username = console.readLine("\nPlease enter the ssh username for host '$host': ")
|
||||||
|
password = new String(console.readPassword("Please enter the ssh password for '$host': "))
|
||||||
|
} else {
|
||||||
|
logger.error "Unable to access System.console()."
|
||||||
}
|
}
|
||||||
username = ant.properties["user.$host"]
|
|
||||||
password = ant.properties["pass.$host"]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user