blob: 37adf88bf01954e3709cb4deb65815c0d25c0c59 (
plain) (
blame)
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
36
37
38
39
40
|
import groovy.json.JsonOutput
import org.apache.commons.io.FileUtils
class DataConfig implements Serializable {
String root = '.'
String server_id = ''
String match_prefix = '(.*)'
String direction
Boolean managed = true
Boolean keep_data = false
int keep_builds = 20
int keep_days = 10
def data = [:]
DataConfig(String direction = "upload") {
this.direction = direction.toLowerCase()
//if (!this.isUpload() && !this.isDownload()) {
// throw new Exception("DataConfig.direction argument must be 'upload'"
// + "or 'download' (got: ${this.direction})")
//}
}
def isUpload() {
return this.direction.startsWith('u')
}
def isDownload() {
return this.direction.startswith('d')
}
def insert(String name, String block) {
/* Store JSON directly as string */
this.data[name] = block
}
def insert(String name, block=[:]) {
/* Convert a Groovy Map to JSON and store it */
this.data[name] = JsonOutput.toJson(block)
}
}
|