All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nebula.plugin.stash.tasks.StashTask.groovy Maven / Gradle / Ivy

There is a newer version: 9.0.0
Show newest version
package nebula.plugin.stash.tasks

import nebula.plugin.stash.StashRestApi
import nebula.plugin.stash.StashRestApiImpl
import nebula.plugin.stash.util.ExternalProcess
import nebula.plugin.stash.util.ExternalProcessImpl
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.TaskAction

/**
 * Abstract Stash task that provides basic functionality needed for all tasks of the plugin.
 */
abstract class StashTask extends DefaultTask {
    @Input
    String stashRepo

    @Input
    String stashProject

    @Input
    String stashHost

    @Input
    String stashUser

    @Input
    String stashPassword

    protected ExternalProcess cmd = new ExternalProcessImpl()
    protected StashRestApi stash

    @TaskAction
    void runAction() {
        stash = createStashClient()
        executeStashCommand()
    }

    private StashRestApi createStashClient() {
        stash ?: new StashRestApiImpl(getStashRepo(), getStashProject(), getStashHost(), getStashUser(), getStashPassword())
    }

    abstract void executeStashCommand()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy