.bamboo.specs.extension.bamboo-specs-extension.1.2.6.source-code.PlanExtension.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bamboo-specs-extension Show documentation
Show all versions of bamboo-specs-extension Show documentation
A Kotlin DSL for Bamboo Specs
package com.atlassian.bamboo.specs.extension
import com.atlassian.bamboo.specs.api.builders.Variable
import com.atlassian.bamboo.specs.api.builders.notification.Notification
import com.atlassian.bamboo.specs.api.builders.notification.NotificationType
import com.atlassian.bamboo.specs.api.builders.plan.Plan
import com.atlassian.bamboo.specs.api.builders.plan.Stage
import com.atlassian.bamboo.specs.api.builders.trigger.AnyTrigger
import com.atlassian.bamboo.specs.api.builders.trigger.Trigger
fun Plan.stage(name: String, description: String? = null, finalStage: Boolean? = null, manual: Boolean? = null, init: SpecsDsl = {}) {
val stage = Stage(name)
if (description != null)
stage.description(description)
if (finalStage != null)
stage.finalStage(finalStage)
if (manual != null)
stage.manual(manual)
stage.init()
this.stages(stage)
}
fun > Plan.trigger(triggerConstructor: () -> T, description: String? = null, enabled: Boolean? = null, init: SpecsDsl = {}) {
val trigger = triggerInitialisation(triggerConstructor, description, enabled, init)
this.triggers(trigger)
}
fun Plan.trigger(triggerType: String, description: String? = null, enabled: Boolean? = null, init: SpecsDsl = {}) {
val trigger = triggerInitialisation(triggerType, description, enabled, init)
this.triggers(trigger)
}
fun Plan.variable(name: String, value: String, init: SpecsDsl = {}) {
val variable = Variable(name, value)
variable.init()
this.variables(variable)
}
fun > Plan.notification(notificationTypeConstructor: () -> T, init: SpecsDsl = {}) {
val notification = notificationInitialisation(notificationTypeConstructor, init)
this.notifications(notification)
}
fun Plan.notification(notificationTypeType: String, init: SpecsDsl = {}) {
val notification = notificationInitialisation(notificationTypeType, init)
this.notifications(notification)
}