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.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/common/CONTRIBUTING.md +1 -1
  3. data/lib/trackler/version.rb +1 -1
  4. data/lib/trackler.rb +0 -5
  5. data/tracks/c/config.json +0 -5
  6. data/tracks/clojure/config.json +177 -59
  7. data/tracks/clojure/exercises/kindergarten-garden/src/example.clj +10 -8
  8. data/tracks/elisp/config.json +60 -24
  9. data/tracks/elixir/exercises/poker/poker_test.exs +1 -1
  10. data/tracks/fortran/config.json +6 -0
  11. data/tracks/fortran/exercises/pangram/example.f90 +33 -0
  12. data/tracks/fortran/exercises/pangram/pangram.fun +42 -0
  13. data/tracks/go/config.json +10 -4
  14. data/tracks/go/exercises/acronym/acronym.go +1 -1
  15. data/tracks/groovy/{SETUP.md → docs/EXERCISE_README_INSERT.md} +0 -0
  16. data/tracks/haskell/config.json +1 -1
  17. data/tracks/java/bin/journey-test.sh +3 -0
  18. data/tracks/java/config.json +14 -14
  19. data/tracks/java/exercises/binary-search/src/test/java/BinarySearchTest.java +20 -20
  20. data/tracks/java/exercises/binary-search-tree/src/test/java/BSTTest.java +32 -32
  21. data/tracks/java/exercises/build.gradle +57 -31
  22. data/tracks/java/exercises/hello-world/GETTING_STARTED.md +4 -0
  23. data/tracks/java/exercises/pythagorean-triplet/src/test/java/PythagoreanTripletTest.java +8 -8
  24. data/tracks/java/exercises/scrabble-score/src/example/java/Scrabble.java +1 -1
  25. data/tracks/java/exercises/scrabble-score/src/test/java/ScrabbleScoreTest.java +10 -5
  26. data/tracks/java/exercises/series/src/test/java/SeriesTest.java +20 -20
  27. data/tracks/java/gradle/wrapper/gradle-wrapper.jar +0 -0
  28. data/tracks/java/gradle/wrapper/gradle-wrapper.properties +2 -2
  29. data/tracks/julia/runtests.jl +1 -6
  30. data/tracks/kotlin/.gitignore +0 -5
  31. data/tracks/kotlin/.travis.yml +21 -1
  32. data/tracks/kotlin/bin/build-jq.sh +11 -0
  33. data/tracks/kotlin/bin/fetch-configlet +1 -1
  34. data/tracks/kotlin/bin/journey-test.sh +34 -14
  35. data/tracks/kotlin/bin/unit-tests.sh +2 -2
  36. data/tracks/kotlin/config.json +230 -160
  37. data/tracks/kotlin/exercises/build.gradle +3 -0
  38. data/tracks/kotlin/exercises/collatz-conjecture/src/test/kotlin/CollatzCalculatorTest.kt +7 -1
  39. data/tracks/kotlin/exercises/gradle.properties +1 -0
  40. data/tracks/kotlin/exercises/list-ops/HINTS.md +5 -0
  41. data/tracks/kotlin/exercises/list-ops/build.gradle +28 -0
  42. data/tracks/kotlin/exercises/list-ops/src/example/kotlin/CustomListExtensions.kt +43 -0
  43. data/tracks/kotlin/exercises/list-ops/src/main/kotlin/.keep +0 -0
  44. data/tracks/kotlin/exercises/list-ops/src/test/kotlin/ListExtensionsTest.kt +157 -0
  45. data/tracks/kotlin/exercises/settings.gradle +13 -12
  46. data/tracks/kotlin/gradle/wrapper/gradle-wrapper.jar +0 -0
  47. data/tracks/kotlin/gradle/wrapper/gradle-wrapper.properties +6 -0
  48. data/tracks/kotlin/gradlew +172 -0
  49. data/tracks/kotlin/gradlew.bat +84 -0
  50. data/tracks/lfe/config.json +90 -30
  51. data/tracks/ocaml/.travis-ci.sh +1 -1
  52. data/tracks/ocaml/.travis.yml +1 -1
  53. data/tracks/ocaml/README.md +1 -1
  54. data/tracks/perl5/.travis.yml +3 -2
  55. data/tracks/perl6/bin/exercise-gen.pl6 +6 -3
  56. data/tracks/racket/config.json +63 -21
  57. data/tracks/ruby/exercises/bob/bob_test.rb +0 -1
  58. data/tracks/ruby/lib/generator/command_line.rb +7 -3
  59. data/tracks/ruby/lib/generator/exercise.rb +19 -0
  60. data/tracks/ruby/lib/generator/files/generator_cases.rb +0 -4
  61. data/tracks/ruby/lib/generator/files/metadata_files.rb +1 -1
  62. data/tracks/ruby/lib/generator/files/track_files.rb +3 -3
  63. data/tracks/ruby/lib/generator/implementation.rb +7 -11
  64. data/tracks/ruby/lib/generator/template_values.rb +5 -9
  65. data/tracks/ruby/lib/generator/underscore.rb +4 -0
  66. data/tracks/ruby/lib/generator.rb +2 -2
  67. data/tracks/ruby/test/fixtures/xruby/lib/generator/test_template.erb +3 -3
  68. data/tracks/ruby/test/generator/exercise_test.rb +20 -0
  69. data/tracks/ruby/test/generator/files/generate_cases_test.rb +0 -4
  70. data/tracks/ruby/test/generator/files/metadata_files_test.rb +2 -2
  71. data/tracks/ruby/test/generator/files/track_files_test.rb +4 -5
  72. data/tracks/ruby/test/generator/implementation_test.rb +12 -20
  73. data/tracks/ruby/test/generator/template_values_test.rb +2 -33
  74. data/tracks/ruby/test/generator/underscore_test.rb +4 -0
  75. data/tracks/ruby/test/generator_test.rb +2 -2
  76. data/tracks/rust/exercises/gigasecond/Cargo.lock +58 -13
  77. data/tracks/rust/exercises/gigasecond/Cargo.toml +1 -1
  78. data/tracks/scala/exercises/acronym/src/test/scala/AcronymTest.scala +32 -12
  79. data/tracks/scala/exercises/hamming/example.scala +1 -1
  80. data/tracks/scala/exercises/hamming/src/test/scala/HammingTest.scala +55 -19
  81. data/tracks/scala/exercises/phone-number/example.scala +10 -20
  82. data/tracks/scala/exercises/phone-number/src/test/scala/PhoneNumberTest.scala +28 -81
  83. data/tracks/scala/testgen/src/main/scala/AcronymTestGenerator.scala +16 -0
  84. data/tracks/scala/testgen/src/main/scala/HammingTestGenerator.scala +34 -0
  85. data/tracks/scala/testgen/src/main/scala/PhoneNumberTestGenerator.scala +34 -0
  86. data/tracks/scheme/config.json +43 -16
  87. metadata +21 -5
  88. data/lib/trackler/problem.rb +0 -7
  89. data/lib/trackler/problems.rb +0 -7
@@ -1,41 +1,67 @@
1
- subprojects { project ->
2
- apply plugin: "java"
3
-
4
- sourceSets {
5
- // Verify that the tests are working by running them against the example code.
6
- // By replacing the "main" sourceSet with the example code we avoid any collisions
7
- // with solution code that may have been included as a "starter" (e.g. etl).
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
- starterSource {
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
- // In lieu of being able to disable @Ignore in JUnit tests, we filter
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 "build/gen/test/java"
22
+ into generatedTestSourceDir
35
23
  filter { line ->
36
- line.contains("@Ignore") ? "" : line
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
- test.dependsOn(copyTestsFilteringIgnores)
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 sut = new PythagoreanTriplet(3, 4, 5);
17
+ PythagoreanTriplet triplet = new PythagoreanTriplet(3, 4, 5);
18
18
  final int expected = 12;
19
- final int actual = sut.calculateSum();
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 sut = new PythagoreanTriplet(3, 4, 5);
26
+ PythagoreanTriplet triplet = new PythagoreanTriplet(3, 4, 5);
27
27
  final long expected = 60l;
28
- final long actual = sut.calculateProduct();
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 sut = new PythagoreanTriplet(3, 4, 5);
36
- assertTrue(sut.isPythagorean());
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 sut = new PythagoreanTriplet(5, 6, 7);
43
- assertFalse(sut.isPythagorean());
42
+ PythagoreanTriplet triplet = new PythagoreanTriplet(5, 6, 7);
43
+ assertFalse(triplet.isPythagorean());
44
44
  }
45
45
 
46
46
  @Test
@@ -45,7 +45,7 @@ final class Scrabble {
45
45
  }
46
46
 
47
47
  private static int getScore(String input) {
48
- if (input == null || input.trim().isEmpty()) {
48
+ if (input.trim().isEmpty()) {
49
49
  return 0;
50
50
  }
51
51
 
@@ -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
- {"OXYPHENBUTAZONE", 41},
27
- {"alacrity", 13},
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 sut = new Series("01234");
20
+ Series series = new Series("01234");
21
21
  List<Integer> expected = Arrays.asList(0, 1, 2, 3, 4);
22
- List<Integer> actual = sut.getDigits();
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 sut = new Series("0123456789");
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 = sut.getDigits();
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 sut = new Series("9876543210");
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 = sut.getDigits();
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 sut = new Series("936923468");
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 = sut.getDigits();
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 sut = new Series("01234");
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 = sut.slices(1);
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 sut = new Series("98273463");
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 = sut.slices(2);
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 sut = new Series("01234");
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 = sut.slices(3);
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 sut = new Series("31001");
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 = sut.slices(3);
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 sut = new Series("91274");
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 = sut.slices(4);
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 sut = new Series("81228");
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 = sut.slices(5);
148
+ List<List<Integer>> actual = series.slices(5);
149
149
  assertNotNull(actual);
150
150
  assertFalse(actual.isEmpty());
151
151
  assertEquals(expected, actual);
@@ -1,6 +1,6 @@
1
- #Tue May 23 10:48:11 BST 2017
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-3.5-bin.zip
6
+ distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-bin.zip
@@ -31,17 +31,12 @@ for (root, dirs, files) in walkdir("exercises")
31
31
 
32
32
  try
33
33
  # Run the tests
34
- result = @testset "$exercise example" begin
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
@@ -7,8 +7,3 @@ build
7
7
  .gradle
8
8
  .idea
9
9
  *.iml
10
-
11
- gradle/
12
- gradlew
13
- gradlew.bat
14
-
@@ -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
- cache: bundler
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/
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env bash
2
+ set -ex
3
+
4
+ pushd bin
5
+ curl --location https://github.com/stedolan/jq/releases/download/jq-1.5/jq-1.5.tar.gz >jq-1.5.tar.gz
6
+ tar xvf jq-1.5.tar.gz
7
+ cd jq-1.5
8
+ ./configure --disable-maintainer-mode && make
9
+ mv jq ..
10
+ popd
11
+
@@ -1,4 +1,4 @@
1
- #!/bin/bash
1
+ #!/usr/bin/env bash
2
2
 
3
3
  LATEST=https://github.com/exercism/configlet/releases/latest
4
4
 
@@ -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
- # on track, please create a companion PR to merge it in to the other. Thank you!
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
- gradle clean
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
- local download_url=${CLI_RELEASES}/download/${version}/exercism-${os}-${arch}.tgz
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
- curl -s --location ${download_url} | tar xz -C ${exercism_home}
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[] .slug' --raw-output`
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
- gradle compileTestJava
219
- # Ensure we run all the tests (as delivered, all but the first is @Ignore'd)
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
- gradle test
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
- assert_installed "gradle"
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
- gradle --version
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 gradle check compileStarterSourceKotlin --continue
13
+ TERM=dumb ../gradlew check compileStarterSourceKotlin --continue
14
14
  popd
15
15