trackler 2.1.0.36 → 2.1.0.37
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/common/CONTRIBUTING.md +1 -1
- data/lib/trackler/version.rb +1 -1
- data/lib/trackler.rb +0 -5
- data/tracks/c/config.json +0 -5
- data/tracks/clojure/config.json +177 -59
- data/tracks/clojure/exercises/kindergarten-garden/src/example.clj +10 -8
- data/tracks/elisp/config.json +60 -24
- data/tracks/elixir/exercises/poker/poker_test.exs +1 -1
- data/tracks/fortran/config.json +6 -0
- data/tracks/fortran/exercises/pangram/example.f90 +33 -0
- data/tracks/fortran/exercises/pangram/pangram.fun +42 -0
- data/tracks/go/config.json +10 -4
- data/tracks/go/exercises/acronym/acronym.go +1 -1
- data/tracks/groovy/{SETUP.md → docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/haskell/config.json +1 -1
- data/tracks/java/bin/journey-test.sh +3 -0
- data/tracks/java/config.json +14 -14
- data/tracks/java/exercises/binary-search/src/test/java/BinarySearchTest.java +20 -20
- data/tracks/java/exercises/binary-search-tree/src/test/java/BSTTest.java +32 -32
- data/tracks/java/exercises/build.gradle +57 -31
- data/tracks/java/exercises/hello-world/GETTING_STARTED.md +4 -0
- data/tracks/java/exercises/pythagorean-triplet/src/test/java/PythagoreanTripletTest.java +8 -8
- data/tracks/java/exercises/scrabble-score/src/example/java/Scrabble.java +1 -1
- data/tracks/java/exercises/scrabble-score/src/test/java/ScrabbleScoreTest.java +10 -5
- data/tracks/java/exercises/series/src/test/java/SeriesTest.java +20 -20
- data/tracks/java/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/tracks/java/gradle/wrapper/gradle-wrapper.properties +2 -2
- data/tracks/julia/runtests.jl +1 -6
- data/tracks/kotlin/.gitignore +0 -5
- data/tracks/kotlin/.travis.yml +21 -1
- data/tracks/kotlin/bin/build-jq.sh +11 -0
- data/tracks/kotlin/bin/fetch-configlet +1 -1
- data/tracks/kotlin/bin/journey-test.sh +34 -14
- data/tracks/kotlin/bin/unit-tests.sh +2 -2
- data/tracks/kotlin/config.json +230 -160
- data/tracks/kotlin/exercises/build.gradle +3 -0
- data/tracks/kotlin/exercises/collatz-conjecture/src/test/kotlin/CollatzCalculatorTest.kt +7 -1
- data/tracks/kotlin/exercises/gradle.properties +1 -0
- data/tracks/kotlin/exercises/list-ops/HINTS.md +5 -0
- data/tracks/kotlin/exercises/list-ops/build.gradle +28 -0
- data/tracks/kotlin/exercises/list-ops/src/example/kotlin/CustomListExtensions.kt +43 -0
- data/tracks/kotlin/exercises/list-ops/src/main/kotlin/.keep +0 -0
- data/tracks/kotlin/exercises/list-ops/src/test/kotlin/ListExtensionsTest.kt +157 -0
- data/tracks/kotlin/exercises/settings.gradle +13 -12
- data/tracks/kotlin/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/tracks/kotlin/gradle/wrapper/gradle-wrapper.properties +6 -0
- data/tracks/kotlin/gradlew +172 -0
- data/tracks/kotlin/gradlew.bat +84 -0
- data/tracks/lfe/config.json +90 -30
- data/tracks/ocaml/.travis-ci.sh +1 -1
- data/tracks/ocaml/.travis.yml +1 -1
- data/tracks/ocaml/README.md +1 -1
- data/tracks/perl5/.travis.yml +3 -2
- data/tracks/perl6/bin/exercise-gen.pl6 +6 -3
- data/tracks/racket/config.json +63 -21
- data/tracks/ruby/exercises/bob/bob_test.rb +0 -1
- data/tracks/ruby/lib/generator/command_line.rb +7 -3
- data/tracks/ruby/lib/generator/exercise.rb +19 -0
- data/tracks/ruby/lib/generator/files/generator_cases.rb +0 -4
- data/tracks/ruby/lib/generator/files/metadata_files.rb +1 -1
- data/tracks/ruby/lib/generator/files/track_files.rb +3 -3
- data/tracks/ruby/lib/generator/implementation.rb +7 -11
- data/tracks/ruby/lib/generator/template_values.rb +5 -9
- data/tracks/ruby/lib/generator/underscore.rb +4 -0
- data/tracks/ruby/lib/generator.rb +2 -2
- data/tracks/ruby/test/fixtures/xruby/lib/generator/test_template.erb +3 -3
- data/tracks/ruby/test/generator/exercise_test.rb +20 -0
- data/tracks/ruby/test/generator/files/generate_cases_test.rb +0 -4
- data/tracks/ruby/test/generator/files/metadata_files_test.rb +2 -2
- data/tracks/ruby/test/generator/files/track_files_test.rb +4 -5
- data/tracks/ruby/test/generator/implementation_test.rb +12 -20
- data/tracks/ruby/test/generator/template_values_test.rb +2 -33
- data/tracks/ruby/test/generator/underscore_test.rb +4 -0
- data/tracks/ruby/test/generator_test.rb +2 -2
- data/tracks/rust/exercises/gigasecond/Cargo.lock +58 -13
- data/tracks/rust/exercises/gigasecond/Cargo.toml +1 -1
- data/tracks/scala/exercises/acronym/src/test/scala/AcronymTest.scala +32 -12
- data/tracks/scala/exercises/hamming/example.scala +1 -1
- data/tracks/scala/exercises/hamming/src/test/scala/HammingTest.scala +55 -19
- data/tracks/scala/exercises/phone-number/example.scala +10 -20
- data/tracks/scala/exercises/phone-number/src/test/scala/PhoneNumberTest.scala +28 -81
- data/tracks/scala/testgen/src/main/scala/AcronymTestGenerator.scala +16 -0
- data/tracks/scala/testgen/src/main/scala/HammingTestGenerator.scala +34 -0
- data/tracks/scala/testgen/src/main/scala/PhoneNumberTestGenerator.scala +34 -0
- data/tracks/scheme/config.json +43 -16
- metadata +21 -5
- data/lib/trackler/problem.rb +0 -7
- data/lib/trackler/problems.rb +0 -7
@@ -1,41 +1,67 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
main {
|
9
|
-
java.srcDirs = ["src/example/java"]
|
10
|
-
}
|
11
|
-
project["compileJava"].doFirst { compileTask ->
|
12
|
-
println " (source = ${compileTask.source.asPath})"
|
13
|
-
}
|
1
|
+
// This root Gradle project is used for:
|
2
|
+
//
|
3
|
+
// - Checking that every test suite compiles against its corresponding example implementation;
|
4
|
+
// - Checking that every example implementation passes its corresponding test suite;
|
5
|
+
// - Checking that every provided starter implementation compiles.
|
6
|
+
//
|
7
|
+
// This file is never delivered to Exercism users.
|
14
8
|
|
15
|
-
|
16
|
-
java.srcDirs = ["src/main/java"]
|
17
|
-
}
|
18
|
-
project["compileStarterSourceJava"].doFirst { compileTask ->
|
19
|
-
println " (source = ${compileTask.source.asPath})"
|
20
|
-
}
|
9
|
+
def generatedTestSourceDir = "build/gen/test/java"
|
21
10
|
|
22
|
-
|
23
|
-
// those annotations, placing the edited tests in the path named here.
|
24
|
-
test {
|
25
|
-
java.srcDirs = ["build/gen/test/java"]
|
26
|
-
}
|
27
|
-
project["compileTestJava"].doFirst { compileTask ->
|
28
|
-
println " (source = ${compileTask.source.asPath})"
|
29
|
-
}
|
30
|
-
}
|
11
|
+
subprojects {
|
31
12
|
|
13
|
+
// Add a task that copies test source files into a build directory. All @Ignore annotations
|
14
|
+
// are removed during this copying, so that when we run the copied tests, none are skipped and
|
15
|
+
// all should execute.
|
16
|
+
//
|
17
|
+
// Note that journey-test.sh also strips @Ignore annotations using sed. The
|
18
|
+
// stripping implementations here and in journey-test.sh should be kept
|
19
|
+
// consistent.
|
32
20
|
task copyTestsFilteringIgnores(type: Copy) {
|
33
21
|
from "src/test/java"
|
34
|
-
into
|
22
|
+
into generatedTestSourceDir
|
35
23
|
filter { line ->
|
36
|
-
line.contains("@Ignore") ?
|
24
|
+
line.contains("@Ignore") ? null : line
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
afterEvaluate { project ->
|
29
|
+
|
30
|
+
sourceSets {
|
31
|
+
// Set the directory containing the example implementation as the default source set. Default
|
32
|
+
// compile tasks will now run against this source set.
|
33
|
+
main {
|
34
|
+
java.srcDirs = ["src/example/java"]
|
35
|
+
}
|
36
|
+
|
37
|
+
// Define a custom source set named "starterSource" that points to the starter implementations
|
38
|
+
// delivered to users. We can then use the generated "compileStarterSourceJava" task to verify
|
39
|
+
// that the starter source compiles as-is.
|
40
|
+
starterSource {
|
41
|
+
java.srcDirs = ["src/main/java"]
|
42
|
+
}
|
43
|
+
|
44
|
+
// Set the directory containing the @Ignore-stripped tests as the default test source set.
|
45
|
+
// Default test tasks will now run against this source set.
|
46
|
+
test {
|
47
|
+
java.srcDirs = [generatedTestSourceDir]
|
48
|
+
}
|
49
|
+
|
50
|
+
// Log the source paths associated with each source set to verify they are what we expect.
|
51
|
+
logCompileTaskSourcePath(project, "compileJava") // Corresponds to the "main" source set.
|
52
|
+
logCompileTaskSourcePath(project, "compileStarterSourceJava")
|
53
|
+
logCompileTaskSourcePath(project, "compileTestJava")
|
37
54
|
}
|
55
|
+
|
56
|
+
// When running the standard test task, make sure we prepopulate the test source set with the
|
57
|
+
// @Ignore-stripped tests.
|
58
|
+
test.dependsOn(copyTestsFilteringIgnores)
|
38
59
|
}
|
39
60
|
|
40
|
-
|
61
|
+
}
|
62
|
+
|
63
|
+
def logCompileTaskSourcePath(Project project, String taskName) {
|
64
|
+
project[taskName].doFirst { compileTask ->
|
65
|
+
println " (source = ${compileTask.source.asPath})"
|
66
|
+
}
|
41
67
|
}
|
@@ -18,6 +18,10 @@ Try writing a solution that passes one test at a time, running Gradle each time:
|
|
18
18
|
$ gradle test
|
19
19
|
```
|
20
20
|
|
21
|
+
To help you focus on one test at a time, [@Ignore](http://junit.sourceforge.net/javadoc/org/junit/Ignore.html)
|
22
|
+
annotations have been added to every test but the first one. Any test with an `@Ignore` annotation will be skipped
|
23
|
+
when you run the tests.
|
24
|
+
|
21
25
|
## Iterate through the tests
|
22
26
|
|
23
27
|
After your first test passes, remove the `@Ignore` from the next test, and iterate on your solution,
|
@@ -14,33 +14,33 @@ public class PythagoreanTripletTest {
|
|
14
14
|
|
15
15
|
@Test
|
16
16
|
public void shouldCalculateSum() {
|
17
|
-
PythagoreanTriplet
|
17
|
+
PythagoreanTriplet triplet = new PythagoreanTriplet(3, 4, 5);
|
18
18
|
final int expected = 12;
|
19
|
-
final int actual =
|
19
|
+
final int actual = triplet.calculateSum();
|
20
20
|
assertEquals(expected, actual);
|
21
21
|
}
|
22
22
|
|
23
23
|
@Test
|
24
24
|
@Ignore("Remove to run test")
|
25
25
|
public void shouldCalculateProduct() {
|
26
|
-
PythagoreanTriplet
|
26
|
+
PythagoreanTriplet triplet = new PythagoreanTriplet(3, 4, 5);
|
27
27
|
final long expected = 60l;
|
28
|
-
final long actual =
|
28
|
+
final long actual = triplet.calculateProduct();
|
29
29
|
assertEquals(expected, actual);
|
30
30
|
}
|
31
31
|
|
32
32
|
@Test
|
33
33
|
@Ignore("Remove to run test")
|
34
34
|
public void testIsPythagoreanOK() {
|
35
|
-
PythagoreanTriplet
|
36
|
-
assertTrue(
|
35
|
+
PythagoreanTriplet triplet = new PythagoreanTriplet(3, 4, 5);
|
36
|
+
assertTrue(triplet.isPythagorean());
|
37
37
|
}
|
38
38
|
|
39
39
|
@Test
|
40
40
|
@Ignore("Remove to run test")
|
41
41
|
public void testIsPythagoreanFail() {
|
42
|
-
PythagoreanTriplet
|
43
|
-
assertFalse(
|
42
|
+
PythagoreanTriplet triplet = new PythagoreanTriplet(5, 6, 7);
|
43
|
+
assertFalse(triplet.isPythagorean());
|
44
44
|
}
|
45
45
|
|
46
46
|
@Test
|
@@ -7,6 +7,9 @@ import java.util.Collection;
|
|
7
7
|
|
8
8
|
import static org.junit.Assert.assertEquals;
|
9
9
|
|
10
|
+
/*
|
11
|
+
* version: 1.0.0
|
12
|
+
*/
|
10
13
|
@RunWith(Parameterized.class)
|
11
14
|
public class ScrabbleScoreTest {
|
12
15
|
|
@@ -16,15 +19,17 @@ public class ScrabbleScoreTest {
|
|
16
19
|
@Parameterized.Parameters(name = "{index}: expected scrabble score for \"{0}\" to be {1}")
|
17
20
|
public static Collection<Object[]> data() {
|
18
21
|
return Arrays.asList(new Object[][]{
|
19
|
-
{"", 0},
|
20
|
-
{" \t\n", 0},
|
21
|
-
{null, 0},
|
22
22
|
{"a", 1},
|
23
|
+
{"A", 1},
|
23
24
|
{"f", 4},
|
25
|
+
{"at", 2},
|
26
|
+
{"zoo", 12},
|
24
27
|
{"street", 6},
|
25
28
|
{"quirky", 22},
|
26
|
-
{"
|
27
|
-
{"
|
29
|
+
{"OxyphenButazone", 41},
|
30
|
+
{"pinata", 8},
|
31
|
+
{"", 0},
|
32
|
+
{"abcdefghijklmnopqrstuvwxyz", 87},
|
28
33
|
});
|
29
34
|
}
|
30
35
|
|
@@ -17,9 +17,9 @@ public class SeriesTest {
|
|
17
17
|
|
18
18
|
@Test
|
19
19
|
public void hasDigitsShort() {
|
20
|
-
Series
|
20
|
+
Series series = new Series("01234");
|
21
21
|
List<Integer> expected = Arrays.asList(0, 1, 2, 3, 4);
|
22
|
-
List<Integer> actual =
|
22
|
+
List<Integer> actual = series.getDigits();
|
23
23
|
assertNotNull(actual);
|
24
24
|
assertFalse(actual.isEmpty());
|
25
25
|
assertEquals(expected, actual);
|
@@ -28,9 +28,9 @@ public class SeriesTest {
|
|
28
28
|
@Test
|
29
29
|
@Ignore("Remove to run test")
|
30
30
|
public void hasDigitsLong() {
|
31
|
-
Series
|
31
|
+
Series series = new Series("0123456789");
|
32
32
|
List<Integer> expected = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
|
33
|
-
List<Integer> actual =
|
33
|
+
List<Integer> actual = series.getDigits();
|
34
34
|
assertNotNull(actual);
|
35
35
|
assertFalse(actual.isEmpty());
|
36
36
|
assertEquals(expected, actual);
|
@@ -39,9 +39,9 @@ public class SeriesTest {
|
|
39
39
|
@Test
|
40
40
|
@Ignore("Remove to run test")
|
41
41
|
public void keepsTheDigitOrderIfReversed() {
|
42
|
-
Series
|
42
|
+
Series series = new Series("9876543210");
|
43
43
|
List<Integer> expected = Arrays.asList(9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
|
44
|
-
List<Integer> actual =
|
44
|
+
List<Integer> actual = series.getDigits();
|
45
45
|
assertNotNull(actual);
|
46
46
|
assertFalse(actual.isEmpty());
|
47
47
|
assertEquals(expected, actual);
|
@@ -50,9 +50,9 @@ public class SeriesTest {
|
|
50
50
|
@Test
|
51
51
|
@Ignore("Remove to run test")
|
52
52
|
public void keepsArbitraryDigitOrder() {
|
53
|
-
Series
|
53
|
+
Series series = new Series("936923468");
|
54
54
|
List<Integer> expected = Arrays.asList(9, 3, 6, 9, 2, 3, 4, 6, 8);
|
55
|
-
List<Integer> actual =
|
55
|
+
List<Integer> actual = series.getDigits();
|
56
56
|
assertNotNull(actual);
|
57
57
|
assertFalse(actual.isEmpty());
|
58
58
|
assertEquals(expected, actual);
|
@@ -61,7 +61,7 @@ public class SeriesTest {
|
|
61
61
|
@Test
|
62
62
|
@Ignore("Remove to run test")
|
63
63
|
public void canSliceByOne() {
|
64
|
-
Series
|
64
|
+
Series series = new Series("01234");
|
65
65
|
List<List<Integer>> expected = Arrays.asList(
|
66
66
|
Arrays.asList(0),
|
67
67
|
Arrays.asList(1),
|
@@ -69,7 +69,7 @@ public class SeriesTest {
|
|
69
69
|
Arrays.asList(3),
|
70
70
|
Arrays.asList(4)
|
71
71
|
);
|
72
|
-
List<List<Integer>> actual =
|
72
|
+
List<List<Integer>> actual = series.slices(1);
|
73
73
|
assertNotNull(actual);
|
74
74
|
assertFalse(actual.isEmpty());
|
75
75
|
assertEquals(expected, actual);
|
@@ -78,7 +78,7 @@ public class SeriesTest {
|
|
78
78
|
@Test
|
79
79
|
@Ignore("Remove to run test")
|
80
80
|
public void canSliceByTwo() {
|
81
|
-
Series
|
81
|
+
Series series = new Series("98273463");
|
82
82
|
List<List<Integer>> expected = Arrays.asList(
|
83
83
|
Arrays.asList(9, 8),
|
84
84
|
Arrays.asList(8, 2),
|
@@ -88,7 +88,7 @@ public class SeriesTest {
|
|
88
88
|
Arrays.asList(4, 6),
|
89
89
|
Arrays.asList(6, 3)
|
90
90
|
);
|
91
|
-
List<List<Integer>> actual =
|
91
|
+
List<List<Integer>> actual = series.slices(2);
|
92
92
|
assertNotNull(actual);
|
93
93
|
assertFalse(actual.isEmpty());
|
94
94
|
assertEquals(expected, actual);
|
@@ -97,13 +97,13 @@ public class SeriesTest {
|
|
97
97
|
@Test
|
98
98
|
@Ignore("Remove to run test")
|
99
99
|
public void canSliceByThree() {
|
100
|
-
Series
|
100
|
+
Series series = new Series("01234");
|
101
101
|
List<List<Integer>> expected = Arrays.asList(
|
102
102
|
Arrays.asList(0, 1, 2),
|
103
103
|
Arrays.asList(1, 2, 3),
|
104
104
|
Arrays.asList(2, 3, 4)
|
105
105
|
);
|
106
|
-
List<List<Integer>> actual =
|
106
|
+
List<List<Integer>> actual = series.slices(3);
|
107
107
|
assertNotNull(actual);
|
108
108
|
assertFalse(actual.isEmpty());
|
109
109
|
assertEquals(expected, actual);
|
@@ -112,13 +112,13 @@ public class SeriesTest {
|
|
112
112
|
@Test
|
113
113
|
@Ignore("Remove to run test")
|
114
114
|
public void canSliceByThreeWithDuplicateDigits() {
|
115
|
-
Series
|
115
|
+
Series series = new Series("31001");
|
116
116
|
List<List<Integer>> expected = Arrays.asList(
|
117
117
|
Arrays.asList(3, 1, 0),
|
118
118
|
Arrays.asList(1, 0, 0),
|
119
119
|
Arrays.asList(0, 0, 1)
|
120
120
|
);
|
121
|
-
List<List<Integer>> actual =
|
121
|
+
List<List<Integer>> actual = series.slices(3);
|
122
122
|
assertNotNull(actual);
|
123
123
|
assertFalse(actual.isEmpty());
|
124
124
|
assertEquals(expected, actual);
|
@@ -127,12 +127,12 @@ public class SeriesTest {
|
|
127
127
|
@Test
|
128
128
|
@Ignore("Remove to run test")
|
129
129
|
public void canSliceByFour() {
|
130
|
-
Series
|
130
|
+
Series series = new Series("91274");
|
131
131
|
List<List<Integer>> expected = Arrays.asList(
|
132
132
|
Arrays.asList(9, 1, 2, 7),
|
133
133
|
Arrays.asList(1, 2, 7, 4)
|
134
134
|
);
|
135
|
-
List<List<Integer>> actual =
|
135
|
+
List<List<Integer>> actual = series.slices(4);
|
136
136
|
assertNotNull(actual);
|
137
137
|
assertFalse(actual.isEmpty());
|
138
138
|
assertEquals(expected, actual);
|
@@ -141,11 +141,11 @@ public class SeriesTest {
|
|
141
141
|
@Test
|
142
142
|
@Ignore("Remove to run test")
|
143
143
|
public void canSliceByFive() {
|
144
|
-
Series
|
144
|
+
Series series = new Series("81228");
|
145
145
|
List<List<Integer>> expected = Arrays.asList(
|
146
146
|
Arrays.asList(8, 1, 2, 2, 8)
|
147
147
|
);
|
148
|
-
List<List<Integer>> actual =
|
148
|
+
List<List<Integer>> actual = series.slices(5);
|
149
149
|
assertNotNull(actual);
|
150
150
|
assertFalse(actual.isEmpty());
|
151
151
|
assertEquals(expected, actual);
|
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
#Wed Jun 14 14:21:29 EDT 2017
|
2
2
|
distributionBase=GRADLE_USER_HOME
|
3
3
|
distributionPath=wrapper/dists
|
4
4
|
zipStoreBase=GRADLE_USER_HOME
|
5
5
|
zipStorePath=wrapper/dists
|
6
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-
|
6
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-bin.zip
|
data/tracks/julia/runtests.jl
CHANGED
@@ -31,17 +31,12 @@ for (root, dirs, files) in walkdir("exercises")
|
|
31
31
|
|
32
32
|
try
|
33
33
|
# Run the tests
|
34
|
-
|
34
|
+
@testset "$exercise example" begin
|
35
35
|
include(joinpath(temp_path, "runtests.jl"))
|
36
36
|
end
|
37
37
|
finally
|
38
38
|
# Delete the temporary directory
|
39
39
|
rm(temp_path, recursive=true)
|
40
40
|
end
|
41
|
-
|
42
|
-
# Print test output (this is the default behaviour for older versions of Julia)
|
43
|
-
if VERSION > v"0.6.0-dev"
|
44
|
-
Base.Test.print_test_results(result)
|
45
|
-
end
|
46
41
|
end
|
47
42
|
end
|
data/tracks/kotlin/.gitignore
CHANGED
data/tracks/kotlin/.travis.yml
CHANGED
@@ -3,16 +3,36 @@ language: java
|
|
3
3
|
jdk:
|
4
4
|
- oraclejdk8
|
5
5
|
|
6
|
+
# http://docs.travis-ci.com/user/migrating-from-legacy
|
6
7
|
sudo: false
|
7
|
-
|
8
|
+
|
8
9
|
addons:
|
9
10
|
apt:
|
10
11
|
packages:
|
11
12
|
- tree
|
13
|
+
|
12
14
|
before_install:
|
13
15
|
- rvm install 2.2.5
|
14
16
|
- rvm use 2.2.5
|
17
|
+
- bin/build-jq.sh # we want jq 1.5 features; not avail through pkg repo.
|
18
|
+
|
19
|
+
# https://docs.travis-ci.com/user/customizing-the-build#Skipping-the-Installation-Step
|
20
|
+
install: true # if we don't skip install, ./gradlew assemble is invoked, but this task is not available.
|
21
|
+
|
22
|
+
before_script:
|
23
|
+
- export PATH=$TRAVIS_BUILD_DIR/bin:$PATH # ensure our tools are prefered over included ones.
|
15
24
|
|
16
25
|
script:
|
17
26
|
- bin/unit-tests.sh
|
18
27
|
- bin/journey-test.sh
|
28
|
+
|
29
|
+
# configure caching (https://docs.travis-ci.com/user/languages/java/#Caching)
|
30
|
+
before_cache:
|
31
|
+
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
32
|
+
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
|
33
|
+
# format from https://docs.travis-ci.com/user/caching/#Enabling-multiple-caching-features
|
34
|
+
cache:
|
35
|
+
bundler: true
|
36
|
+
directories:
|
37
|
+
- $HOME/.gradle/caches/
|
38
|
+
- $HOME/.gradle/wrapper/
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
2
|
|
3
3
|
# This script is shared between the Java and Kotlin tracks. If you make an update to this script on
|
4
|
-
#
|
4
|
+
# one track, please create a companion PR to merge it in to the other. Thank you!
|
5
5
|
TRACK=kotlin
|
6
6
|
TRACK_REPO="x${TRACK}"
|
7
7
|
TRACK_SRC_EXT="kt"
|
@@ -65,7 +65,7 @@ clean() {
|
|
65
65
|
rm -rf "${build_path}"
|
66
66
|
fi
|
67
67
|
cd exercises
|
68
|
-
|
68
|
+
"$EXECPATH"/gradlew clean
|
69
69
|
cd ..
|
70
70
|
echo "<<< clean()"
|
71
71
|
}
|
@@ -78,6 +78,8 @@ get_operating_system() {
|
|
78
78
|
echo "linux";;
|
79
79
|
(Windows*)
|
80
80
|
echo "windows";;
|
81
|
+
(MINGW*)
|
82
|
+
echo "windows";;
|
81
83
|
(*)
|
82
84
|
echo "linux";;
|
83
85
|
esac
|
@@ -108,10 +110,25 @@ download_exercism_cli() {
|
|
108
110
|
# "curl..." :: HTTP 302 headers, including "Location" -- URL to redirect to.
|
109
111
|
# "awk..." :: pluck last path segment from "Location" (i.e. the version number)
|
110
112
|
local version="$(curl --head --silent ${latest} | awk -v FS=/ '/Location:/{print $NF}' | tr -d '\r')"
|
111
|
-
|
113
|
+
|
114
|
+
local download_url_suffix
|
115
|
+
local unzip_command
|
116
|
+
local unzip_from_file_option
|
117
|
+
if [[ ${os} == "windows" ]] ; then
|
118
|
+
download_url_suffix="zip"
|
119
|
+
unzip_command="unzip -d"
|
120
|
+
unzip_from_file_option=""
|
121
|
+
else
|
122
|
+
download_url_suffix="tgz"
|
123
|
+
unzip_command="tar xz -C"
|
124
|
+
unzip_from_file_option="-f"
|
125
|
+
fi
|
126
|
+
local download_url=${CLI_RELEASES}/download/${version}/exercism-${os}-${arch}.${download_url_suffix}
|
112
127
|
|
113
128
|
mkdir -p ${exercism_home}
|
114
|
-
|
129
|
+
local temp=`mktemp`
|
130
|
+
curl -s --location ${download_url} > ${temp}
|
131
|
+
${unzip_command} ${exercism_home} ${unzip_from_file_option} ${temp}
|
115
132
|
echo "<<< download_exercism_cli()"
|
116
133
|
}
|
117
134
|
|
@@ -132,6 +149,11 @@ make_local_trackler() {
|
|
132
149
|
|
133
150
|
local track_root=$( pwd )
|
134
151
|
pushd ${trackler}
|
152
|
+
|
153
|
+
# Get the version of Trackler x-api is currently using
|
154
|
+
local version=$( grep -m 1 'trackler' ${xapi_home}/Gemfile.lock | sed 's/.*(//' | sed 's/)//' )
|
155
|
+
|
156
|
+
git checkout v${version}
|
135
157
|
git submodule init -- common
|
136
158
|
git submodule update
|
137
159
|
|
@@ -141,10 +163,6 @@ make_local_trackler() {
|
|
141
163
|
cp ${track_root}/config.json tracks/${TRACK}
|
142
164
|
cp -r ${track_root}/exercises tracks/${TRACK}
|
143
165
|
|
144
|
-
# Set the version to that expected by x-api
|
145
|
-
version=$( grep -m 1 'trackler' ${xapi_home}/Gemfile.lock | sed 's/.*(//' | sed 's/)//' )
|
146
|
-
echo "module Trackler VERSION = \"${version}\" end" > lib/trackler/version.rb
|
147
|
-
|
148
166
|
gem install bundler
|
149
167
|
bundle install
|
150
168
|
gem build trackler.gemspec
|
@@ -198,7 +216,7 @@ solve_all_exercises() {
|
|
198
216
|
|
199
217
|
local track_root=$( pwd )
|
200
218
|
local exercism_cli="./exercism --config ${exercism_configfile}"
|
201
|
-
local exercises=`cat config.json | jq '.exercises[]
|
219
|
+
local exercises=`cat config.json | jq '.exercises[].slug + " "' --join-output`
|
202
220
|
local total_exercises=`cat config.json | jq '.exercises | length'`
|
203
221
|
local current_exercise_number=1
|
204
222
|
local tempfile="${TMPDIR:-/tmp}/journey-test.sh-unignore_all_tests.txt"
|
@@ -215,12 +233,14 @@ solve_all_exercises() {
|
|
215
233
|
|
216
234
|
pushd ${exercism_exercises_dir}/${TRACK}/${exercise}
|
217
235
|
# Check that tests compile before we strip @Ignore annotations
|
218
|
-
|
219
|
-
#
|
236
|
+
"$EXECPATH"/gradlew compileTestKotlin
|
237
|
+
# Strip @Ignore annotations to ensure we run the tests (as delivered, all but the first is @Ignore'd).
|
238
|
+
# Note that unit-test.sh also strips @Ignore annotations via the Gradle task copyTestsFilteringIgnores.
|
239
|
+
# The stripping implementations here and in copyTestsFilteringIgnores should be kept consistent.
|
220
240
|
for testfile in `find . -name "*Test.${TRACK_SRC_EXT}"`; do
|
221
|
-
sed 's/@Ignore//' ${testfile} > "${tempfile}" && mv "${tempfile}" "${testfile}"
|
241
|
+
sed 's/@Ignore\(\(.*\)\)\{0,1\}//' ${testfile} > "${tempfile}" && mv "${tempfile}" "${testfile}"
|
222
242
|
done
|
223
|
-
|
243
|
+
"$EXECPATH"/gradlew test
|
224
244
|
popd
|
225
245
|
|
226
246
|
current_exercise_number=$((current_exercise_number + 1))
|
@@ -243,7 +263,7 @@ main() {
|
|
243
263
|
local exercism_configfile=".journey-test.exercism.json"
|
244
264
|
local xapi_port=9292
|
245
265
|
|
246
|
-
|
266
|
+
# fail fast if required binaries are not installed.
|
247
267
|
assert_installed "jq"
|
248
268
|
|
249
269
|
clean "${build_dir}"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
2
|
set -e
|
3
|
-
|
3
|
+
./gradlew --version
|
4
4
|
|
5
5
|
echo ""
|
6
6
|
echo ">>> Running configlet..."
|
@@ -10,6 +10,6 @@ bin/configlet .
|
|
10
10
|
pushd exercises
|
11
11
|
echo ""
|
12
12
|
echo ">>> Running tests..."
|
13
|
-
TERM=dumb
|
13
|
+
TERM=dumb ../gradlew check compileStarterSourceKotlin --continue
|
14
14
|
popd
|
15
15
|
|