org.hidetake.gradle.ssh.SshTask.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-ssh-plugin Show documentation
Show all versions of gradle-ssh-plugin Show documentation
Gradle SSH Plugin provides remote execution and file transfer capabilities
package org.hidetake.gradle.ssh
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.TaskAction
import org.hidetake.gradle.ssh.api.SshService
import org.hidetake.gradle.ssh.api.SshSpec
import org.hidetake.gradle.ssh.internal.DefaultSshService
import org.hidetake.gradle.ssh.internal.DryRunSshService
/**
* SSH task.
*
* @see SshService
* @author hidetake.org
*
*/
class SshTask extends DefaultTask {
protected service = DefaultSshService.instance
protected dryRunService = DryRunSshService.instance
/**
* Delegate of task specific settings.
* This overrides global settings.
*/
@Delegate
final SshSpec sshSpec = new SshSpec()
@TaskAction
void perform() {
def convention = project.convention.getPlugin(SshPluginConvention)
def merged = SshSpec.computeMerged(sshSpec, convention.sshSpec)
if (merged.dryRun) {
dryRunService.execute(merged)
} else {
service.execute(merged)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy