-
Notifications
You must be signed in to change notification settings - Fork 0
/
DestroyBundleTask.groovy
35 lines (28 loc) · 1 KB
/
DestroyBundleTask.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.felipefzdz.gradle.heroku.tasks
import com.felipefzdz.gradle.heroku.HerokuAppContainer
import com.felipefzdz.gradle.heroku.heroku.HerokuClient
import com.felipefzdz.gradle.heroku.tasks.model.HerokuApp
import com.felipefzdz.gradle.heroku.tasks.services.DestroyAppService
import groovy.transform.CompileStatic
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.TaskAction
import javax.inject.Inject
@CompileStatic
class DestroyBundleTask extends HerokuBaseTask {
@Internal
HerokuAppContainer bundle
private final HerokuClient herokuClient
private final DestroyAppService destroyAppService
@Inject
DestroyBundleTask(HerokuClient herokuClient, DestroyAppService destroyAppService) {
this.herokuClient = herokuClient
this.destroyAppService = destroyAppService
}
@TaskAction
void destroyBundle() {
bundle.toList().each { HerokuApp app ->
destroyAppService.destroyApp(app.name)
}
}
}