trackler 2.0.7.0 → 2.0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/common/exercises/counter/metadata.yml +0 -4
- data/common/exercises/error-handling/metadata.yml +0 -4
- data/common/exercises/etl/canonical-data.json +1 -1
- data/common/exercises/hello-world/canonical-data.json +9 -21
- data/common/exercises/hello-world/description.md +7 -42
- data/common/exercises/hello-world/metadata.yml +1 -1
- data/common/exercises/lens-person/metadata.yml +0 -3
- data/common/exercises/luhn/canonical-data.json +17 -17
- data/common/exercises/nucleotide-codons/metadata.yml +0 -2
- data/common/exercises/react/metadata.yml +0 -2
- data/common/exercises/rectangles/metadata.yml +0 -3
- data/common/exercises/variable-length-quantity/metadata.yml +0 -2
- data/fixtures/tracks/snowflake/config.json +17 -0
- data/fixtures/tracks/snowflake/exercises/snowflake-only/description.md +1 -0
- data/fixtures/tracks/snowflake/exercises/snowflake-only/metadata.yml +4 -0
- data/lib/trackler/description.rb +27 -0
- data/lib/trackler/guaranteed_file.rb +77 -0
- data/lib/trackler/implementations.rb +5 -5
- data/lib/trackler/metadata.rb +27 -0
- data/lib/trackler/null_track.rb +22 -0
- data/lib/trackler/problem.rb +32 -34
- data/lib/trackler/track.rb +1 -1
- data/lib/trackler/version.rb +1 -1
- data/tracks/csharp/exercises/hello-world/Example.cs +2 -5
- data/tracks/csharp/exercises/hello-world/HelloWorldTest.cs +2 -16
- data/tracks/elixir/config.json +7 -0
- data/tracks/elixir/exercises/series/example.exs +13 -0
- data/tracks/elixir/exercises/series/series.exs +11 -0
- data/tracks/elixir/exercises/series/series_test.exs +53 -0
- data/tracks/erlang/README.md +3 -3
- data/tracks/erlang/config.json +15 -11
- data/tracks/erlang/exercises/{binary → all-your-base}/include/exercism.hrl +0 -0
- data/tracks/erlang/exercises/{binary → all-your-base}/rebar.config +0 -0
- data/tracks/erlang/exercises/{trinary/src/trinary.app.src → all-your-base/src/all_your_base.app.src} +2 -2
- data/tracks/erlang/exercises/all-your-base/src/example.erl +33 -0
- data/tracks/erlang/exercises/all-your-base/test/all_your_base_tests.erl +69 -0
- data/tracks/erlang/exercises/hello-world/src/example.erl +4 -4
- data/tracks/erlang/exercises/hello-world/test/hello_world_tests.erl +3 -12
- data/tracks/erlang/exercises/{trinary → rotational-cipher}/include/exercism.hrl +0 -0
- data/tracks/erlang/exercises/{trinary → rotational-cipher}/rebar.config +8 -1
- data/tracks/erlang/exercises/rotational-cipher/src/example.erl +19 -0
- data/tracks/erlang/exercises/{binary/src/binary.app.src → rotational-cipher/src/rotational_cipher.app.src} +2 -2
- data/tracks/erlang/exercises/rotational-cipher/test/rotational_cipher_tests.erl +98 -0
- data/tracks/fsharp/exercises/grep/GrepTest.fs +57 -0
- data/tracks/fsharp/exercises/hello-world/Example.fs +1 -1
- data/tracks/fsharp/exercises/hello-world/HelloWorldTest.fs +2 -12
- data/tracks/go/.travis.yml +7 -15
- data/tracks/go/exercises/hello-world/example.go +4 -8
- data/tracks/go/exercises/hello-world/hello_test.go +20 -16
- data/tracks/go/exercises/hello-world/hello_world.go +12 -2
- data/tracks/groovy/exercises/hello-world/Example.groovy +2 -2
- data/tracks/groovy/exercises/hello-world/HelloWorld.groovy +1 -1
- data/tracks/groovy/exercises/hello-world/HelloWorldSpec.groovy +1 -14
- data/tracks/haskell/config.json +6 -0
- data/tracks/haskell/exercises/hello-world/HINTS.md +6 -0
- data/tracks/haskell/exercises/hello-world/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/hello-world/examples/success-standard/src/HelloWorld.hs +4 -0
- data/tracks/haskell/exercises/hello-world/package.yaml +19 -0
- data/tracks/haskell/exercises/hello-world/src/HelloWorld.hs +4 -0
- data/tracks/haskell/exercises/hello-world/stack.yaml +1 -0
- data/tracks/haskell/exercises/hello-world/test/Tests.hs +13 -0
- data/tracks/idris/config.json +9 -0
- data/tracks/idris/exercises/leap/Leap.ipkg +5 -0
- data/tracks/idris/exercises/leap/Makefile +23 -0
- data/tracks/idris/exercises/leap/src/Leap.idr +5 -0
- data/tracks/idris/exercises/leap/src/Test/Leap.idr +37 -0
- data/tracks/idris/exercises/leap/src/example.idr +8 -0
- data/tracks/{typescript/exercises → java}/.keep +0 -0
- data/tracks/java/config.json +115 -172
- data/tracks/java/exercises/anagram/src/test/java/AnagramTest.java +41 -13
- data/tracks/java/exercises/list-ops/build.gradle +18 -0
- data/tracks/java/exercises/list-ops/src/example/java/ListOps.java +51 -0
- data/tracks/java/exercises/list-ops/src/main/java/.keep +0 -0
- data/tracks/java/exercises/list-ops/src/test/java/ListOpsTest.java +316 -0
- data/tracks/java/exercises/palindrome-products/src/example/java/Palindromes.java +28 -62
- data/tracks/java/exercises/palindrome-products/src/test/java/PalindromesTest.java +26 -83
- data/tracks/java/exercises/settings.gradle +1 -0
- data/tracks/julia/config.json +1 -2
- data/tracks/julia/exercises/hello-world/example.jl +2 -2
- data/tracks/julia/exercises/hello-world/runtests.jl +1 -6
- data/tracks/lua/exercises/TRACK_HINTS.md +8 -0
- data/tracks/lua/exercises/hello-world/example.lua +2 -3
- data/tracks/lua/exercises/hello-world/hello-world.lua +18 -0
- data/tracks/lua/exercises/hello-world/hello-world_spec.lua +6 -12
- data/tracks/ocaml/exercises/phone-number/example.ml +8 -18
- data/tracks/ocaml/exercises/phone-number/phone_number.mli +1 -7
- data/tracks/ocaml/exercises/phone-number/test.ml +24 -23
- data/tracks/ocaml/tools/test-generator/src/special_cases.ml +6 -0
- data/tracks/ocaml/tools/test-generator/templates/phone-number/template.ml +21 -0
- data/tracks/pony/config.json +2 -2
- data/tracks/pony/exercises/hello-world/example.pony +1 -2
- data/tracks/pony/exercises/hello-world/test.pony +0 -1
- data/tracks/rust/config.json +0 -1
- data/tracks/rust/exercises/hello-world/example.rs +2 -5
- data/tracks/rust/exercises/hello-world/tests/hello-world.rs +2 -14
- data/tracks/scala/config.json +11 -2
- data/tracks/scala/docs/LEARNING.md +10 -2
- data/tracks/scala/docs/RESOURCES.md +0 -1
- data/tracks/scala/docs/TESTS.md +10 -6
- data/tracks/scala/exercises/rail-fence-cipher/build.sbt +3 -0
- data/tracks/scala/exercises/rail-fence-cipher/example.scala +46 -0
- data/tracks/scala/exercises/rail-fence-cipher/src/main/scala/RailFenceCipher.scala +0 -0
- data/tracks/scala/exercises/rail-fence-cipher/src/test/scala/RailFenceCipherTest.scala +42 -0
- data/tracks/scala/testgen/src/main/scala/RailFenceCipherTestGenerator.scala +59 -0
- data/tracks/typescript/.gitignore +7 -0
- data/tracks/typescript/.travis.yml +18 -1
- data/tracks/typescript/Dangerfile +43 -0
- data/tracks/typescript/Makefile +57 -0
- data/tracks/typescript/README.md +38 -5
- data/tracks/typescript/SETUP.md +24 -0
- data/tracks/typescript/common/package.json +37 -0
- data/tracks/typescript/common/tsconfig.json +21 -0
- data/tracks/typescript/common/tslint.json +127 -0
- data/tracks/typescript/common/yarn.lock +2697 -0
- data/tracks/typescript/config.json +82 -2
- data/tracks/typescript/docs/ABOUT.md +1 -0
- data/tracks/typescript/docs/INSTALLATION.md +17 -0
- data/tracks/typescript/docs/LEARNING.md +8 -0
- data/tracks/typescript/docs/RESOURCES.md +7 -0
- data/tracks/typescript/docs/TESTS.md +36 -0
- data/tracks/typescript/exercises/anagram/anagram.example.ts +23 -0
- data/tracks/typescript/exercises/anagram/anagram.test.ts +82 -0
- data/tracks/typescript/exercises/anagram/package.json +37 -0
- data/tracks/typescript/exercises/anagram/tsconfig.json +21 -0
- data/tracks/typescript/exercises/anagram/tslint.json +127 -0
- data/tracks/typescript/exercises/anagram/yarn.lock +2697 -0
- data/tracks/typescript/exercises/beer-song/beer-song.example.ts +36 -0
- data/tracks/typescript/exercises/beer-song/beer-song.test.ts +360 -0
- data/tracks/typescript/exercises/beer-song/package.json +37 -0
- data/tracks/typescript/exercises/beer-song/tsconfig.json +21 -0
- data/tracks/typescript/exercises/beer-song/tslint.json +127 -0
- data/tracks/typescript/exercises/beer-song/yarn.lock +2697 -0
- data/tracks/typescript/exercises/bob/bob.example.ts +24 -0
- data/tracks/typescript/exercises/bob/bob.test.ts +92 -0
- data/tracks/typescript/exercises/bob/package.json +37 -0
- data/tracks/typescript/exercises/bob/tsconfig.json +21 -0
- data/tracks/typescript/exercises/bob/tslint.json +127 -0
- data/tracks/typescript/exercises/bob/yarn.lock +2697 -0
- data/tracks/typescript/exercises/gigasecond/gigasecond.example.ts +11 -0
- data/tracks/typescript/exercises/gigasecond/gigasecond.test.ts +29 -0
- data/tracks/typescript/exercises/gigasecond/package.json +37 -0
- data/tracks/typescript/exercises/gigasecond/tsconfig.json +21 -0
- data/tracks/typescript/exercises/gigasecond/tslint.json +127 -0
- data/tracks/typescript/exercises/gigasecond/yarn.lock +2697 -0
- data/tracks/typescript/exercises/hamming/hamming.example.ts +19 -0
- data/tracks/typescript/exercises/hamming/hamming.test.ts +39 -0
- data/tracks/typescript/exercises/hamming/package.json +37 -0
- data/tracks/typescript/exercises/hamming/tsconfig.json +21 -0
- data/tracks/typescript/exercises/hamming/tslint.json +127 -0
- data/tracks/typescript/exercises/hamming/yarn.lock +2697 -0
- data/tracks/typescript/exercises/hello-world/hello-world.example.ts +8 -0
- data/tracks/typescript/exercises/hello-world/hello-world.test.ts +17 -0
- data/tracks/typescript/exercises/hello-world/package.json +37 -0
- data/tracks/typescript/exercises/hello-world/tsconfig.json +21 -0
- data/tracks/typescript/exercises/hello-world/tslint.json +127 -0
- data/tracks/typescript/exercises/hello-world/yarn.lock +2697 -0
- data/tracks/typescript/exercises/leap/leap.example.ts +6 -0
- data/tracks/typescript/exercises/leap/leap.test.ts +39 -0
- data/tracks/typescript/exercises/leap/package.json +37 -0
- data/tracks/typescript/exercises/leap/tsconfig.json +21 -0
- data/tracks/typescript/exercises/leap/tslint.json +127 -0
- data/tracks/typescript/exercises/leap/yarn.lock +2697 -0
- data/tracks/typescript/exercises/pangram/package.json +37 -0
- data/tracks/typescript/exercises/pangram/pangram.example.ts +32 -0
- data/tracks/typescript/exercises/pangram/pangram.test.ts +50 -0
- data/tracks/typescript/exercises/pangram/tsconfig.json +21 -0
- data/tracks/typescript/exercises/pangram/tslint.json +127 -0
- data/tracks/typescript/exercises/pangram/yarn.lock +2697 -0
- data/tracks/typescript/exercises/phone-number/package.json +37 -0
- data/tracks/typescript/exercises/phone-number/phone-number.example.ts +21 -0
- data/tracks/typescript/exercises/phone-number/phone-number.test.ts +55 -0
- data/tracks/typescript/exercises/phone-number/tsconfig.json +21 -0
- data/tracks/typescript/exercises/phone-number/tslint.json +127 -0
- data/tracks/typescript/exercises/phone-number/yarn.lock +2697 -0
- data/tracks/typescript/exercises/rna-transcription/package.json +37 -0
- data/tracks/typescript/exercises/rna-transcription/rna-transcription.example.ts +13 -0
- data/tracks/typescript/exercises/rna-transcription/rna-transcription.test.ts +45 -0
- data/tracks/typescript/exercises/rna-transcription/tsconfig.json +21 -0
- data/tracks/typescript/exercises/rna-transcription/tslint.json +127 -0
- data/tracks/typescript/exercises/rna-transcription/yarn.lock +2697 -0
- data/tracks/typescript/exercises/say/package.json +37 -0
- data/tracks/typescript/exercises/say/say.example.ts +95 -0
- data/tracks/typescript/exercises/say/say.test.ts +78 -0
- data/tracks/typescript/exercises/say/tsconfig.json +21 -0
- data/tracks/typescript/exercises/say/tslint.json +127 -0
- data/tracks/typescript/exercises/say/yarn.lock +2697 -0
- data/tracks/typescript/exercises/word-count/package.json +37 -0
- data/tracks/typescript/exercises/word-count/tsconfig.json +21 -0
- data/tracks/typescript/exercises/word-count/tslint.json +127 -0
- data/tracks/typescript/exercises/word-count/word-count.example.ts +16 -0
- data/tracks/typescript/exercises/word-count/word-count.test.ts +65 -0
- data/tracks/typescript/exercises/word-count/yarn.lock +2697 -0
- data/tracks/typescript/exercises/wordy/package.json +37 -0
- data/tracks/typescript/exercises/wordy/tsconfig.json +21 -0
- data/tracks/typescript/exercises/wordy/tslint.json +127 -0
- data/tracks/typescript/exercises/wordy/wordy.example.ts +40 -0
- data/tracks/typescript/exercises/wordy/wordy.test.ts +89 -0
- data/tracks/typescript/exercises/wordy/yarn.lock +2697 -0
- data/tracks/typescript/img/icon.png +0 -0
- data/tracks/typescript/img/icon.svg +10 -0
- metadata +134 -15
- data/tracks/erlang/exercises/binary/src/example.erl +0 -20
- data/tracks/erlang/exercises/binary/test/binary_string_tests.erl +0 -26
- data/tracks/erlang/exercises/trinary/Makefile +0 -10
- data/tracks/erlang/exercises/trinary/src/example.erl +0 -66
- data/tracks/erlang/exercises/trinary/test/trinary_tests.erl +0 -36
- data/tracks/fsharp/exercises/hello-world/HINTS.md +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31fb33c6f6d2b730536826f3f4636068f82e8fa6
|
4
|
+
data.tar.gz: a508d69520c86df66d8d401c138c8416309dee96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c054cb72f146dad2bbc5d2f1db8b7dd1c5e2d335fc1354036ed49b7f3d59e5ea1a5675e7ed2f543ccd0543acd14edffaf7048ca9a333a55bdf528a8e2d2abb07
|
7
|
+
data.tar.gz: 91f5aac573c1b8180254ecf5000ad9d3e297f9731b478149dbd1df2c157ab3119f78b424f5590706a00cc81ee275369c62b2c4489fd847ff5eba5a1efbc48a79
|
data/CHANGELOG.md
CHANGED
@@ -15,6 +15,14 @@ The changelog will not be updated for content updates.
|
|
15
15
|
## Next Release
|
16
16
|
* **Your contribution here**
|
17
17
|
|
18
|
+
## v2.0.8.0 (2017-02-21)
|
19
|
+
|
20
|
+
* Handle track-specific exercises
|
21
|
+
|
22
|
+
## v2.0.7.0 (2017-02-20)
|
23
|
+
|
24
|
+
* Add Vim script track
|
25
|
+
|
18
26
|
## v2.0.6.0 (2017-01-03)
|
19
27
|
|
20
28
|
* Deprecate SETUP.md in favor of a new, better-named TRACK_HINTS.md file.
|
@@ -1,23 +1,11 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
},
|
12
|
-
{
|
13
|
-
"description": "sample name",
|
14
|
-
"name": "Alice",
|
15
|
-
"expected": "Hello, Alice!"
|
16
|
-
},
|
17
|
-
{
|
18
|
-
"description": "other sample name",
|
19
|
-
"name": "Bob",
|
20
|
-
"expected": "Hello, Bob!"
|
21
|
-
}
|
22
|
-
]
|
2
|
+
"exercise":"hello-world",
|
3
|
+
"version":"0.1.0",
|
4
|
+
"cases":[
|
5
|
+
{
|
6
|
+
"description":"Say Hi!",
|
7
|
+
"property":"hello",
|
8
|
+
"expected":"Hello, World!"
|
9
|
+
}
|
10
|
+
]
|
23
11
|
}
|
@@ -1,46 +1,11 @@
|
|
1
1
|
["Hello, World!"](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) is
|
2
|
-
the traditional first program for beginning programming in a new language
|
2
|
+
the traditional first program for beginning programming in a new language
|
3
|
+
or environment.
|
3
4
|
|
4
|
-
|
5
|
+
The objectives are simple:
|
5
6
|
|
6
|
-
|
7
|
+
- Write a function that says "Hello, World!".
|
8
|
+
- Run the test suite and make sure that it succeeds.
|
9
|
+
- Submit your solution and check it at the website.
|
7
10
|
|
8
|
-
|
9
|
-
|
10
|
-
Write a `Hello World!` function that can greet someone given their name. The
|
11
|
-
function should return the appropriate greeting.
|
12
|
-
|
13
|
-
For an input of "Alice", the response should be "Hello, Alice!".
|
14
|
-
|
15
|
-
If a name is not given, the response should be "Hello, World!"
|
16
|
-
|
17
|
-
## Test-Driven Development
|
18
|
-
|
19
|
-
As programmers mature, they eventually want to test their code.
|
20
|
-
|
21
|
-
Here at Exercism we simulate [Test-Driven
|
22
|
-
Development](http://en.wikipedia.org/wiki/Test-driven_development) (TDD), where
|
23
|
-
you write your tests before writing any functionality. The simulation comes in
|
24
|
-
the form of a pre-written test suite, which will signal that you have solved
|
25
|
-
the problem.
|
26
|
-
|
27
|
-
It will also provide you with a safety net to explore other solutions without
|
28
|
-
breaking the functionality.
|
29
|
-
|
30
|
-
### A typical TDD workflow on Exercism:
|
31
|
-
|
32
|
-
1. Run the test file and pick one test that's failing.
|
33
|
-
2. Write some code to fix the test you picked.
|
34
|
-
3. Re-run the tests to confirm the test is now passing.
|
35
|
-
4. Repeat from step 1.
|
36
|
-
5. Submit your solution (`exercism submit /path/to/file`)
|
37
|
-
|
38
|
-
## Instructions
|
39
|
-
|
40
|
-
Submissions are encouraged to be general, within reason. Having said that, it's
|
41
|
-
also important not to over-engineer a solution.
|
42
|
-
|
43
|
-
It's important to remember that the goal is to make code as expressive and
|
44
|
-
readable as we can. However, solutions to the hello-world exercise will not be
|
45
|
-
reviewed by a person, but by rikki- the robot, who will offer an encouraging
|
46
|
-
word.
|
11
|
+
If everything goes well, you will be ready to fetch your first real exercise.
|
@@ -1,4 +1,4 @@
|
|
1
1
|
---
|
2
|
-
blurb: '
|
2
|
+
blurb: 'The classical introductory exercise. Just say "Hello, World!"'
|
3
3
|
source: "This is an exercise to introduce users to using Exercism"
|
4
4
|
source_url: "http://en.wikipedia.org/wiki/%22Hello,_world!%22_program"
|
@@ -11,18 +11,23 @@
|
|
11
11
|
"expected": false
|
12
12
|
},
|
13
13
|
{
|
14
|
-
"description": "simple valid
|
15
|
-
"input": "
|
14
|
+
"description": "a simple valid SIN that remains valid if reversed",
|
15
|
+
"input": "059",
|
16
16
|
"expected": true
|
17
17
|
},
|
18
18
|
{
|
19
|
-
"description": "valid
|
20
|
-
"input": "
|
19
|
+
"description": "a simple valid SIN that becomes invalid if reversed",
|
20
|
+
"input": "59",
|
21
|
+
"expected": true
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"description": "a valid Canadian SIN",
|
25
|
+
"input": "055 444 285",
|
21
26
|
"expected": true
|
22
27
|
},
|
23
28
|
{
|
24
29
|
"description": "invalid Canadian SIN",
|
25
|
-
"input": "
|
30
|
+
"input": "055 444 286",
|
26
31
|
"expected": false
|
27
32
|
},
|
28
33
|
{
|
@@ -31,17 +36,17 @@
|
|
31
36
|
"expected": false
|
32
37
|
},
|
33
38
|
{
|
34
|
-
"description": "valid strings with a non-digit
|
35
|
-
"input": "
|
39
|
+
"description": "valid strings with a non-digit included become invalid",
|
40
|
+
"input": "055a 444 285",
|
36
41
|
"expected": false
|
37
42
|
},
|
38
43
|
{
|
39
|
-
"description": "punctuation
|
44
|
+
"description": "valid strings with punctuation included become invalid",
|
40
45
|
"input": "055-444-285",
|
41
46
|
"expected": false
|
42
47
|
},
|
43
48
|
{
|
44
|
-
"description": "symbols
|
49
|
+
"description": "valid strings with symbols included become invalid",
|
45
50
|
"input": "055£ 444$ 285",
|
46
51
|
"expected": false
|
47
52
|
},
|
@@ -51,17 +56,12 @@
|
|
51
56
|
"expected": false
|
52
57
|
},
|
53
58
|
{
|
54
|
-
"description": "
|
55
|
-
"input": "
|
56
|
-
"expected": true
|
57
|
-
},
|
58
|
-
{
|
59
|
-
"description": "another valid sin",
|
60
|
-
"input": "055 444 285",
|
59
|
+
"description": "more than a single zero is valid",
|
60
|
+
"input": "0000 0",
|
61
61
|
"expected": true
|
62
62
|
},
|
63
63
|
{
|
64
|
-
"description": "
|
64
|
+
"description": "input digit 9 is correctly converted to output digit 9",
|
65
65
|
"input": "091",
|
66
66
|
"expected": true
|
67
67
|
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
{
|
2
|
+
"slug": "snowflake",
|
3
|
+
"language": "Snowflake",
|
4
|
+
"repository": "https://example.com/exercism/xsnowflake",
|
5
|
+
"active": true,
|
6
|
+
"test_pattern": "\\.tst$",
|
7
|
+
"problems": [
|
8
|
+
"apple",
|
9
|
+
"banana",
|
10
|
+
"cherry",
|
11
|
+
"snowflake-only"
|
12
|
+
],
|
13
|
+
"deprecated": [
|
14
|
+
],
|
15
|
+
"foregone": [
|
16
|
+
]
|
17
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
Special snowflakes are _special_
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative 'guaranteed_file'
|
2
|
+
|
3
|
+
module Trackler
|
4
|
+
class Description
|
5
|
+
def self.for(problem:, track: )
|
6
|
+
new(GuaranteedFile.for(problem: problem, track: track, filename: 'description.md'))
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(description_file)
|
10
|
+
@file = description_file
|
11
|
+
@content = description_file.content
|
12
|
+
end
|
13
|
+
private_class_method :new
|
14
|
+
|
15
|
+
def to_s
|
16
|
+
@content
|
17
|
+
end
|
18
|
+
|
19
|
+
def url
|
20
|
+
@file.url
|
21
|
+
end
|
22
|
+
|
23
|
+
def exists?
|
24
|
+
!@content.empty?
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module Trackler
|
2
|
+
class GuaranteedFile
|
3
|
+
attr_accessor :content
|
4
|
+
|
5
|
+
def self.for(problem:, track:, filename:)
|
6
|
+
[TrackFile, CommonFile].detect(-> {NullFile}) do |d|
|
7
|
+
d.send(:exists?, problem: problem, track: track, filename: filename)
|
8
|
+
end.send(:new, problem: problem, track: track, filename: filename)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
attr_accessor :problem, :track, :filename
|
14
|
+
|
15
|
+
def self.exists?(problem:, track:, filename:)
|
16
|
+
File.exists?(location(problem: problem, track: track, filename: filename))
|
17
|
+
end
|
18
|
+
private_class_method :exists?
|
19
|
+
|
20
|
+
def initialize(problem:, track:, filename:)
|
21
|
+
self.problem = problem
|
22
|
+
self.track = track
|
23
|
+
self.filename = filename
|
24
|
+
self.content = File.read(self.class.location(problem: problem, track: track, filename: filename))
|
25
|
+
end
|
26
|
+
private_class_method :new
|
27
|
+
end
|
28
|
+
|
29
|
+
class TrackFile < GuaranteedFile
|
30
|
+
def self.location(problem:, track:, filename:)
|
31
|
+
File.join(problem.root, 'tracks', track.id, 'exercises', problem.slug, filename)
|
32
|
+
end
|
33
|
+
|
34
|
+
def url
|
35
|
+
"#{track.repository}/blob/master/exercises/%s/#{filename}" % problem.slug
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
class CommonFile < GuaranteedFile
|
40
|
+
def self.location(problem:, filename:, **_track)
|
41
|
+
File.join(problem.root, 'common', 'exercises', problem.slug, filename)
|
42
|
+
end
|
43
|
+
|
44
|
+
def url
|
45
|
+
"https://github.com/exercism/x-common/blob/master/exercises/%s/#{filename}" % problem.slug
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class NullFile < GuaranteedFile
|
50
|
+
def method_missing(*)
|
51
|
+
# NOOP
|
52
|
+
end
|
53
|
+
|
54
|
+
def respond_to?(*)
|
55
|
+
true
|
56
|
+
end
|
57
|
+
|
58
|
+
def inspect
|
59
|
+
"<null>"
|
60
|
+
end
|
61
|
+
|
62
|
+
def exists?
|
63
|
+
false
|
64
|
+
end
|
65
|
+
|
66
|
+
def content
|
67
|
+
""
|
68
|
+
end
|
69
|
+
|
70
|
+
def initialize(*)
|
71
|
+
self
|
72
|
+
end
|
73
|
+
|
74
|
+
klass = self
|
75
|
+
define_method(:class) { klass }
|
76
|
+
end
|
77
|
+
end
|
@@ -3,12 +3,12 @@ module Trackler
|
|
3
3
|
class Implementations
|
4
4
|
include Enumerable
|
5
5
|
|
6
|
-
attr_reader :
|
7
|
-
def initialize(
|
8
|
-
@track_id = track_id
|
6
|
+
attr_reader :repo, :slugs, :root, :track
|
7
|
+
def initialize(repo, slugs, root, track)
|
9
8
|
@repo = repo
|
10
9
|
@slugs = slugs
|
11
10
|
@root = root
|
11
|
+
@track = track
|
12
12
|
end
|
13
13
|
|
14
14
|
def each
|
@@ -25,7 +25,7 @@ module Trackler
|
|
25
25
|
|
26
26
|
def all
|
27
27
|
@all ||= slugs.map { |slug|
|
28
|
-
Implementation.new(
|
28
|
+
Implementation.new(track.id, repo, Problem.new(slug, root, track), root)
|
29
29
|
}
|
30
30
|
end
|
31
31
|
|
@@ -35,7 +35,7 @@ module Trackler
|
|
35
35
|
|
36
36
|
def implementation_map
|
37
37
|
hash = Hash.new { |_, k|
|
38
|
-
Implementation.new(
|
38
|
+
Implementation.new(track.id, repo, Problem.new(k, root, track), root)
|
39
39
|
}
|
40
40
|
all.each do |impl|
|
41
41
|
hash[impl.problem.slug] = impl
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative 'guaranteed_file'
|
2
|
+
|
3
|
+
module Trackler
|
4
|
+
class Metadata
|
5
|
+
def self.for(problem:, track: )
|
6
|
+
new(GuaranteedFile.for(problem: problem, track: track, filename: 'metadata.yml'))
|
7
|
+
end
|
8
|
+
|
9
|
+
attr_accessor :blurb, :source, :source_url
|
10
|
+
|
11
|
+
def initialize(metadata_file)
|
12
|
+
@file = metadata_file
|
13
|
+
@attrs = YAML.load(@file.content) || {}
|
14
|
+
%w(blurb source source_url).each do |attr|
|
15
|
+
self.send("#{attr}=".to_sym, @attrs[attr].to_s.strip)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def url
|
20
|
+
@file.url
|
21
|
+
end
|
22
|
+
|
23
|
+
def exists?
|
24
|
+
!@attrs.empty?
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|