-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
57 lines (46 loc) · 1.34 KB
/
build.gradle
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
apply plugin: 'groovy'
apply plugin: 'eclipse'
repositories {
mavenCentral()
}
dependencies {
groovy 'org.codehaus.groovy:groovy-all:1.7.5'
testCompile 'org.spockframework:spock-core:0.5-groovy-1.7'
}
test {
doFirst {
println()
println "If the tests pass we'll add more..."
println()
}
}
task next(dependsOn: test) << {
println()
println "Great! The tests pass, adding new tests..."
println()
def markerFile = new File(project.projectDir, "data/marker.txt")
def marker = markerFile.exists() ? markerFile.text as Integer : 2
def dataDir = new File(project.projectDir, "data")
if (marker > 28) {
println "Well now! You've completed the test-first-challenge! Congratulations!"
} else {
if (marker >= 22) {
writeTest(new File(dataDir, "SheetTableModelTest.groovy"), marker)
}
if (marker <= 22) {
writeTest(new File(dataDir, "SheetTest.groovy"), marker)
}
markerFile.write( ""+(marker+1) )
}
}
def writeTest(file, marker) {
def test = new File(new File(project.projectDir, "/src/test/groovy/com/curiousattemptbunny/testfirstchallenge"), file.name)
def testText = file.text
testText = testText.substring(0,testText.indexOf('/*'+marker+'*/'))+"\n}"
testText = testText.replaceAll("/\\*.*?\\*/", "")
test.write(testText)
println "Updated test: "+test
}
task wrapper(type: Wrapper) {
gradleVersion = '1.0-milestone-1'
}