forked from osoco/groovy-metakoans
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_koans_to_solve.gant
41 lines (32 loc) · 1.39 KB
/
generate_koans_to_solve.gant
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
taskdef name: 'groovyc', classname: 'org.codehaus.groovy.ant.Groovyc'
final KOANS_TO_SOLVE_PROJECT_DIR = "${basedir}/../groovy-metakoans-to-solve"
def patternFor(token) { '/\\*' + token + '\\*/.*?/\\*\\*/' }
target name: 'init', {
mkdir dir: KOANS_TO_SOLVE_PROJECT_DIR
}
target(name: 'cleanKoans') {
delete dir: KOANS_TO_SOLVE_PROJECT_DIR
}
target name: 'makeKoans', {
depends init
copy file: 'build.gant', todir: KOANS_TO_SOLVE_PROJECT_DIR
copy todir: "${KOANS_TO_SOLVE_PROJECT_DIR}/koan_engine", {
fileset dir: "${basedir}/koan_engine", {
include name: '**/*'
}
}
copy todir: "${KOANS_TO_SOLVE_PROJECT_DIR}/koans", {
fileset dir: "${basedir}/koans", {
include name: '**/*.groovy'
include name: '**/*.java'
}
filterchain {
replaceregex pattern: patternFor('koanify'), replace: '__', flags: 'g'
replaceregex pattern: patternFor('koanify_as_class'), replace: 'FillMeIn', flags: 'g'
replaceregex pattern: patternFor('koanify_as_ex'), replace: 'FillMeInException', flags: 'g'
replaceregex pattern: patternFor('koanify_as_should_fail_or_not'), replace: '__should_this_block_fail_or_not__', flags: 'g'
replaceregex pattern: patternFor('koanify_as_implement_me'), replace: '// TODO implement me', flags: 'g'
}
}
}
setDefaultTarget(makeKoans)