trackler 2.2.1.73 → 2.2.1.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/rna-transcription/canonical-data.json +1 -31
- data/problem-specifications/exercises/secret-handshake/metadata.yml +1 -1
- data/tracks/csharp/config.json +10 -0
- data/tracks/csharp/exercises/Exercises.sln +7 -1
- data/tracks/csharp/exercises/armstrong-numbers/ArmstrongNumbers.cs +9 -0
- data/tracks/csharp/exercises/armstrong-numbers/ArmstrongNumbers.csproj +17 -0
- data/tracks/csharp/exercises/armstrong-numbers/ArmstrongNumbersTest.cs +54 -0
- data/tracks/csharp/exercises/armstrong-numbers/Example.cs +18 -0
- data/tracks/csharp/exercises/armstrong-numbers/README.md +10 -0
- data/tracks/csharp/exercises/bob/BobTest.cs +2 -2
- data/tracks/csharp/exercises/bob/Example.cs +2 -0
- data/tracks/csharp/exercises/book-store/BookStoreTest.cs +8 -1
- data/tracks/csharp/exercises/change/README.md +1 -1
- data/tracks/csharp/exercises/rna-transcription/RnaTranscriptionTest.cs +1 -20
- data/tracks/csharp/exercises/secret-handshake/README.md +1 -1
- data/tracks/csharp/exercises/word-count/WordCountTest.cs +12 -0
- data/tracks/csharp/generators/Exercises/ArmstrongNumbers.cs +6 -0
- data/tracks/dart/config.json +4 -3
- data/tracks/dart/config/maintainers.json +3 -3
- data/tracks/delphi/exercises/armstrong-numbers/uArmstrongNumbersExample.pas +13 -10
- data/tracks/delphi/exercises/rna-transcription/uTestRnaTranscription.pas +4 -28
- data/tracks/ecmascript/config.json +5 -5
- data/tracks/fsharp/config.json +11 -0
- data/tracks/fsharp/exercises/Exercises.sln +6 -0
- data/tracks/fsharp/exercises/armstrong-numbers/ArmstrongNumbers.fs +3 -0
- data/tracks/fsharp/exercises/armstrong-numbers/ArmstrongNumbers.fsproj +23 -0
- data/tracks/fsharp/exercises/armstrong-numbers/ArmstrongNumbersTest.fs +41 -0
- data/tracks/fsharp/exercises/armstrong-numbers/Example.fs +7 -0
- data/tracks/fsharp/exercises/armstrong-numbers/Program.fs +1 -0
- data/tracks/fsharp/exercises/armstrong-numbers/README.md +15 -0
- data/tracks/fsharp/exercises/change/README.md +1 -1
- data/tracks/fsharp/exercises/secret-handshake/README.md +1 -1
- data/tracks/fsharp/generators/Common.fs +1 -0
- data/tracks/fsharp/generators/Generators.fs +7 -0
- data/tracks/go/exercises/secret-handshake/README.md +1 -1
- data/tracks/idris/.travis.yml +23 -3
- data/tracks/idris/bin/fetch-exercism-infra.sh +121 -0
- data/tracks/idris/bin/fetch-stack.sh +11 -0
- data/tracks/idris/bin/solve_exercises.sh +59 -0
- data/tracks/idris/config.json +6 -0
- data/tracks/idris/exercises/hello-world/src/HelloWorld.idr +4 -0
- data/tracks/java/exercises/reverse-string/src/main/java/ReverseString.java +1 -1
- data/tracks/javascript/.eslintignore +0 -7
- data/tracks/javascript/config.json +11 -0
- data/tracks/javascript/exercises/anagram/example.js +2 -2
- data/tracks/javascript/exercises/circular-buffer/circular-buffer.spec.js +1 -1
- data/tracks/javascript/exercises/circular-buffer/example.js +1 -1
- data/tracks/javascript/exercises/pangram/example.js +5 -4
- data/tracks/javascript/exercises/say/example.js +5 -2
- data/tracks/javascript/exercises/scrabble-score/example.js +2 -3
- data/tracks/javascript/exercises/secret-handshake/README.md +1 -1
- data/tracks/javascript/exercises/triangle/example.js +3 -2
- data/tracks/javascript/exercises/trinary/example.js +1 -1
- data/tracks/javascript/exercises/two-fer/README.md +41 -0
- data/tracks/javascript/exercises/two-fer/example.js +10 -0
- data/tracks/javascript/exercises/two-fer/two-fer.js +12 -0
- data/tracks/javascript/exercises/two-fer/two-fer.spec.js +18 -0
- data/tracks/kotlin/exercises/secret-handshake/README.md +1 -1
- data/tracks/perl6/exercises/rna-transcription/Example.pm6 +1 -2
- data/tracks/perl6/exercises/rna-transcription/RNA.pm6 +1 -1
- data/tracks/perl6/exercises/rna-transcription/example.yaml +3 -10
- data/tracks/perl6/exercises/rna-transcription/rna-transcription.t +4 -40
- data/tracks/php/exercises/hamming/hamming_test.php +2 -1
- data/tracks/python/config.json +12 -0
- data/tracks/python/exercises/armstrong-numbers/README.md +28 -0
- data/tracks/python/exercises/armstrong-numbers/armstrong_numbers.py +2 -0
- data/tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py +36 -0
- data/tracks/python/exercises/armstrong-numbers/example.py +2 -0
- data/tracks/python/exercises/protein-translation/example.py +1 -1
- data/tracks/python/exercises/protein-translation/protein_translation.py +1 -5
- data/tracks/python/exercises/protein-translation/protein_translation_test.py +30 -19
- data/tracks/ruby/exercises/secret-handshake/README.md +1 -1
- data/tracks/rust/exercises/simple-linked-list/.meta/hints.md +2 -3
- data/tracks/rust/exercises/simple-linked-list/README.md +3 -3
- data/tracks/swift/config.json +13 -0
- data/tracks/swift/exercises/protein-translation/Package.swift +5 -0
- data/tracks/swift/exercises/protein-translation/README.md +56 -0
- data/tracks/swift/exercises/protein-translation/Sources/ProteinTranslation.swift +1 -0
- data/tracks/swift/exercises/protein-translation/Sources/ProteinTranslationExample.swift +54 -0
- data/tracks/swift/exercises/protein-translation/Tests/LinuxMain.swift +6 -0
- data/tracks/swift/exercises/protein-translation/Tests/ProteinTranslationTests/ProteinTranslationTests.swift +83 -0
- metadata +32 -2
|
@@ -237,7 +237,7 @@
|
|
|
237
237
|
]
|
|
238
238
|
},
|
|
239
239
|
{
|
|
240
|
-
"uuid": "
|
|
240
|
+
"uuid": "7f49e997-4435-4f34-a020-bddc92c838ed",
|
|
241
241
|
"slug": "two-fer",
|
|
242
242
|
"core": false,
|
|
243
243
|
"unlocked_by": "hello-world",
|
|
@@ -385,7 +385,7 @@
|
|
|
385
385
|
]
|
|
386
386
|
},
|
|
387
387
|
{
|
|
388
|
-
"uuid": "
|
|
388
|
+
"uuid": "b8dacb3a-51d0-4da7-a6d2-aa29867e2b8c",
|
|
389
389
|
"slug": "collatz-conjecture",
|
|
390
390
|
"core": false,
|
|
391
391
|
"unlocked_by": "leap",
|
|
@@ -1145,7 +1145,7 @@
|
|
|
1145
1145
|
]
|
|
1146
1146
|
},
|
|
1147
1147
|
{
|
|
1148
|
-
"uuid": "
|
|
1148
|
+
"uuid": "64de1776-d5c6-43fe-9abf-7e3aa08ae342",
|
|
1149
1149
|
"slug": "twelve-days",
|
|
1150
1150
|
"core": false,
|
|
1151
1151
|
"unlocked_by": "bob",
|
|
@@ -1160,7 +1160,7 @@
|
|
|
1160
1160
|
]
|
|
1161
1161
|
},
|
|
1162
1162
|
{
|
|
1163
|
-
"uuid": "
|
|
1163
|
+
"uuid": "ea9a9a3e-ae6a-470d-8bb4-2afead507f24",
|
|
1164
1164
|
"slug": "complex-numbers",
|
|
1165
1165
|
"core": false,
|
|
1166
1166
|
"unlocked_by": "space-age",
|
|
@@ -1170,7 +1170,7 @@
|
|
|
1170
1170
|
]
|
|
1171
1171
|
},
|
|
1172
1172
|
{
|
|
1173
|
-
"uuid": "
|
|
1173
|
+
"uuid": "b902c746-60d1-4645-a5bc-dafadec0ef32",
|
|
1174
1174
|
"slug": "isbn-verifier",
|
|
1175
1175
|
"core": false,
|
|
1176
1176
|
"unlocked_by": "bob",
|
data/tracks/fsharp/config.json
CHANGED
|
@@ -114,6 +114,17 @@
|
|
|
114
114
|
"unlocked_by": "sum-of-multiples",
|
|
115
115
|
"uuid": "8b66e691-508f-40d9-8cee-1d6aec27366e"
|
|
116
116
|
},
|
|
117
|
+
{
|
|
118
|
+
"core": false,
|
|
119
|
+
"difficulty": 2,
|
|
120
|
+
"slug": "armstrong-numbers",
|
|
121
|
+
"topics": [
|
|
122
|
+
"integers",
|
|
123
|
+
"mathematics"
|
|
124
|
+
],
|
|
125
|
+
"unlocked_by": "sum-of-multiples",
|
|
126
|
+
"uuid": "e7f74f6c-16ea-40d8-94f7-7034bc6ee938"
|
|
127
|
+
},
|
|
117
128
|
{
|
|
118
129
|
"core": true,
|
|
119
130
|
"difficulty": 3,
|
|
@@ -222,6 +222,8 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "IsbnVerifier", "isbn-verifi
|
|
|
222
222
|
EndProject
|
|
223
223
|
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "SpiralMatrix", "spiral-matrix\SpiralMatrix.fsproj", "{4C02F0E3-90F6-4ACD-9D34-EDFF301B058D}"
|
|
224
224
|
EndProject
|
|
225
|
+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "ArmstrongNumbers", "armstrong-numbers\ArmstrongNumbers.fsproj", "{48345F81-5B0F-4C2C-9403-84CBF918714C}"
|
|
226
|
+
EndProject
|
|
225
227
|
Global
|
|
226
228
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
227
229
|
Debug|Any CPU = Debug|Any CPU
|
|
@@ -668,6 +670,10 @@ Global
|
|
|
668
670
|
{4C02F0E3-90F6-4ACD-9D34-EDFF301B058D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
669
671
|
{4C02F0E3-90F6-4ACD-9D34-EDFF301B058D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
670
672
|
{4C02F0E3-90F6-4ACD-9D34-EDFF301B058D}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
673
|
+
{48345F81-5B0F-4C2C-9403-84CBF918714C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
674
|
+
{48345F81-5B0F-4C2C-9403-84CBF918714C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
675
|
+
{48345F81-5B0F-4C2C-9403-84CBF918714C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
676
|
+
{48345F81-5B0F-4C2C-9403-84CBF918714C}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
671
677
|
EndGlobalSection
|
|
672
678
|
GlobalSection(SolutionProperties) = preSolution
|
|
673
679
|
HideSolutionNode = FALSE
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
|
2
|
+
|
|
3
|
+
<PropertyGroup>
|
|
4
|
+
<TargetFramework>netcoreapp2.0</TargetFramework>
|
|
5
|
+
|
|
6
|
+
<IsPackable>false</IsPackable>
|
|
7
|
+
</PropertyGroup>
|
|
8
|
+
|
|
9
|
+
<ItemGroup>
|
|
10
|
+
<Compile Include="ArmstrongNumbers.fs" />
|
|
11
|
+
<Compile Include="ArmstrongNumbersTest.fs" />
|
|
12
|
+
<Compile Include="Program.fs" />
|
|
13
|
+
</ItemGroup>
|
|
14
|
+
|
|
15
|
+
<ItemGroup>
|
|
16
|
+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
|
|
17
|
+
<PackageReference Include="xunit" Version="2.3.1" />
|
|
18
|
+
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
|
|
19
|
+
<PackageReference Include="FsUnit.xUnit" Version="3.0.0" />
|
|
20
|
+
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
|
|
21
|
+
</ItemGroup>
|
|
22
|
+
|
|
23
|
+
</Project>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// This file was auto-generated based on version 1.0.0 of the canonical data.
|
|
2
|
+
|
|
3
|
+
module ArmstrongNumbersTest
|
|
4
|
+
|
|
5
|
+
open FsUnit.Xunit
|
|
6
|
+
open Xunit
|
|
7
|
+
|
|
8
|
+
open ArmstrongNumbers
|
|
9
|
+
|
|
10
|
+
[<Fact>]
|
|
11
|
+
let ``Single digit numbers are Armstrong numbers`` () =
|
|
12
|
+
isArmstrongNumber 5 |> should equal true
|
|
13
|
+
|
|
14
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
15
|
+
let ``There are no 2 digit Armstrong numbers`` () =
|
|
16
|
+
isArmstrongNumber 10 |> should equal false
|
|
17
|
+
|
|
18
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
19
|
+
let ``Three digit number that is an Armstrong number`` () =
|
|
20
|
+
isArmstrongNumber 153 |> should equal true
|
|
21
|
+
|
|
22
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
23
|
+
let ``Three digit number that is not an Armstrong number`` () =
|
|
24
|
+
isArmstrongNumber 100 |> should equal false
|
|
25
|
+
|
|
26
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
27
|
+
let ``Four digit number that is an Armstrong number`` () =
|
|
28
|
+
isArmstrongNumber 9474 |> should equal true
|
|
29
|
+
|
|
30
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
31
|
+
let ``Four digit number that is not an Armstrong number`` () =
|
|
32
|
+
isArmstrongNumber 9475 |> should equal false
|
|
33
|
+
|
|
34
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
35
|
+
let ``Seven digit number that is an Armstrong number`` () =
|
|
36
|
+
isArmstrongNumber 9926315 |> should equal true
|
|
37
|
+
|
|
38
|
+
[<Fact(Skip = "Remove to run test")>]
|
|
39
|
+
let ``Seven digit number that is not an Armstrong number`` () =
|
|
40
|
+
isArmstrongNumber 9926314 |> should equal false
|
|
41
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module Program = let [<EntryPoint>] main _ = 0
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Armstrong numbers
|
|
2
|
+
|
|
3
|
+
An [Armstrong number](https://en.wikipedia.org/wiki/Narcissistic_number) is a number that is the sum of its own digits each raised to the power of the number of digits.
|
|
4
|
+
|
|
5
|
+
For example:
|
|
6
|
+
|
|
7
|
+
- 9 is an Armstrong number, because `9 = 9^1 = 9`
|
|
8
|
+
- 10 is *not* an Armstrong number, because `10 != 1^2 + 0^2 = 2`
|
|
9
|
+
- 153 is an Armstrong number, because: `153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153`
|
|
10
|
+
- 154 is *not* an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190`
|
|
11
|
+
|
|
12
|
+
Write some code to determine whether a number is an Armstrong number.
|
|
13
|
+
|
|
14
|
+
## Submitting Incomplete Solutions
|
|
15
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
|
@@ -17,7 +17,7 @@ that the sum of the coins' value would equal the correct amount of change.
|
|
|
17
17
|
- Can you ask for a change value smaller than the smallest coin value?
|
|
18
18
|
## Source
|
|
19
19
|
|
|
20
|
-
Software Craftsmanship - Kata-logue [http://craftsmanship.sv.cmu.edu/exercises/coin-change-kata](http://craftsmanship.sv.cmu.edu/exercises/coin-change-kata)
|
|
20
|
+
Software Craftsmanship - Kata-logue [http://craftsmanship.sv.cmu.edu/exercises/coin-change-kata](https://web.archive.org/web/20130115115225/http://craftsmanship.sv.cmu.edu:80/exercises/coin-change-kata)
|
|
21
21
|
|
|
22
22
|
## Submitting Incomplete Solutions
|
|
23
23
|
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
|
@@ -29,7 +29,7 @@ Notice that the addition of 16 (10000 in binary)
|
|
|
29
29
|
has caused the array to be reversed.
|
|
30
30
|
## Source
|
|
31
31
|
|
|
32
|
-
Bert, in Mary Poppins [http://www.imdb.com/
|
|
32
|
+
Bert, in Mary Poppins [http://www.imdb.com/title/tt0058331/quotes/qt0437047](http://www.imdb.com/title/tt0058331/quotes/qt0437047)
|
|
33
33
|
|
|
34
34
|
## Submitting Incomplete Solutions
|
|
35
35
|
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
|
@@ -11,6 +11,7 @@ type CanonicalDataCase =
|
|
|
11
11
|
member this.Description = string this.Properties.["description"]
|
|
12
12
|
member this.Property = string this.Properties.["property"]
|
|
13
13
|
member this.Expected = this.Properties.["expected"]
|
|
14
|
+
member this.Input = this.Properties.["input"]
|
|
14
15
|
|
|
15
16
|
type CanonicalData =
|
|
16
17
|
{ Exercise: string
|
|
@@ -86,6 +86,13 @@ type Anagram() =
|
|
|
86
86
|
|
|
87
87
|
override this.PropertiesWithIdentifier canonicalDataCase = ["candidates"]
|
|
88
88
|
|
|
89
|
+
type ArmstrongNumbers() =
|
|
90
|
+
inherit Exercise()
|
|
91
|
+
|
|
92
|
+
override this.RenderInput (canonicalDataCase, key, value) =
|
|
93
|
+
(value :?> JToken).Value("number")
|
|
94
|
+
|> formatValue
|
|
95
|
+
|
|
89
96
|
type BeerSong() =
|
|
90
97
|
inherit Exercise()
|
|
91
98
|
|
|
@@ -47,7 +47,7 @@ you're having trouble, please visit the exercism.io [Go language page](http://ex
|
|
|
47
47
|
|
|
48
48
|
## Source
|
|
49
49
|
|
|
50
|
-
Bert, in Mary Poppins [http://www.imdb.com/
|
|
50
|
+
Bert, in Mary Poppins [http://www.imdb.com/title/tt0058331/quotes/qt0437047](http://www.imdb.com/title/tt0058331/quotes/qt0437047)
|
|
51
51
|
|
|
52
52
|
## Submitting Incomplete Solutions
|
|
53
53
|
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
data/tracks/idris/.travis.yml
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
language:
|
|
1
|
+
language: haskell
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
env:
|
|
4
|
+
global:
|
|
5
|
+
- RESOLVER=lts-8.17
|
|
6
|
+
|
|
7
|
+
cache:
|
|
8
|
+
bundler: true
|
|
9
|
+
directories:
|
|
10
|
+
- $HOME/.local
|
|
11
|
+
- $HOME/.stack
|
|
12
|
+
- $HOME/.cabal
|
|
13
|
+
|
|
14
|
+
install:
|
|
15
|
+
- rvm install 2.2.5
|
|
16
|
+
- rvm use 2.2.5
|
|
4
17
|
- bin/fetch-configlet
|
|
5
|
-
- bin/
|
|
18
|
+
- bin/fetch-stack.sh
|
|
19
|
+
- bin/fetch-exercism-infra.sh
|
|
20
|
+
- stack --resolver $RESOLVER setup
|
|
21
|
+
- "[[ $(which idris) != '' ]] || travis_wait 60 stack --resolver $RESOLVER install idris"
|
|
22
|
+
|
|
23
|
+
script:
|
|
24
|
+
- bin/configlet .
|
|
25
|
+
- bin/solve_exercises.sh
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
set -x
|
|
4
|
+
|
|
5
|
+
xtrack_home=$(pwd)
|
|
6
|
+
build=${xtrack_home}/build
|
|
7
|
+
|
|
8
|
+
xapi_home=${build}/x-api
|
|
9
|
+
trackler_home=${build}/trackler
|
|
10
|
+
exercism_home=${build}/exercism
|
|
11
|
+
|
|
12
|
+
## Clone into X-API and trackler
|
|
13
|
+
git clone "https://github.com/exercism/x-api" "${xapi_home}"
|
|
14
|
+
git clone "https://github.com/exercism/trackler" "${trackler_home}"
|
|
15
|
+
|
|
16
|
+
#### TRACKLER ####
|
|
17
|
+
|
|
18
|
+
## Get into trackler directory
|
|
19
|
+
pushd ${trackler_home}
|
|
20
|
+
|
|
21
|
+
## Update submodules
|
|
22
|
+
git submodule init -- comoon
|
|
23
|
+
git submodule update
|
|
24
|
+
|
|
25
|
+
## Bake in local version of the track
|
|
26
|
+
rm -rf tracks/idris # TODO: generify the trackname!
|
|
27
|
+
mkdir -p tracks/idris/exercises
|
|
28
|
+
cp "${xtrack_home}/config.json" tracks/idris
|
|
29
|
+
cp -rv "${xtrack_home}/exercises" tracks/idris
|
|
30
|
+
|
|
31
|
+
## Adjust some versioning information
|
|
32
|
+
version=$(grep -m 1 'trackler' ${xapi_home}/Gemfile.lock | sed 's/.*(//' | sed 's/)//')
|
|
33
|
+
echo "module Trackler VERSION = \"${version}\" end" > lib/trackler/version.rb
|
|
34
|
+
|
|
35
|
+
## Install bundler and use it to install dependencies
|
|
36
|
+
[[ $(which bundler) != "" ]] || gem install bundler
|
|
37
|
+
bundle install
|
|
38
|
+
gem build trackler.gemspec
|
|
39
|
+
|
|
40
|
+
## Install the built gem into local registry
|
|
41
|
+
gem install --local "trackler-${version}.gem"
|
|
42
|
+
|
|
43
|
+
popd
|
|
44
|
+
|
|
45
|
+
#### XAPI ####
|
|
46
|
+
|
|
47
|
+
pushd ${xapi_home}
|
|
48
|
+
|
|
49
|
+
## Install the dependencies
|
|
50
|
+
bundle install
|
|
51
|
+
|
|
52
|
+
## Start it in background
|
|
53
|
+
RACK_ENV=development rackup &
|
|
54
|
+
xapi_pid=$!
|
|
55
|
+
sleep 5 # We need to wait a bit here, to avoid race conditions. 5 seconds should be enough
|
|
56
|
+
|
|
57
|
+
echo "x-api is running, pid is ${xapi_pid}."
|
|
58
|
+
|
|
59
|
+
popd
|
|
60
|
+
|
|
61
|
+
#### EXERCISM CLI ####
|
|
62
|
+
|
|
63
|
+
os=$(case $(uname) in
|
|
64
|
+
(Darwin*)
|
|
65
|
+
echo "mac";;
|
|
66
|
+
(Linux*)
|
|
67
|
+
echo "linux";;
|
|
68
|
+
(Windows*)
|
|
69
|
+
echo "windows";;
|
|
70
|
+
(MINGW*)
|
|
71
|
+
echo "windows";;
|
|
72
|
+
(*)
|
|
73
|
+
echo "linux";;
|
|
74
|
+
esac)
|
|
75
|
+
|
|
76
|
+
arch=$(case $(uname -m) in
|
|
77
|
+
(*64*)
|
|
78
|
+
echo 64bit;;
|
|
79
|
+
(*686*)
|
|
80
|
+
echo 32bit;;
|
|
81
|
+
(*386*)
|
|
82
|
+
echo 32bit;;
|
|
83
|
+
(*)
|
|
84
|
+
echo 64bit;;
|
|
85
|
+
esac)
|
|
86
|
+
|
|
87
|
+
## Retrieve exercism client version
|
|
88
|
+
release_url=https://github.com/exercism/cli/releases
|
|
89
|
+
latest_url=${release_url}/latest
|
|
90
|
+
version=$(curl --head --silent ${latest_url} | awk -v FS=/ '/Location:/{print $NF}' | tr -d '\r')
|
|
91
|
+
|
|
92
|
+
## download the tarball
|
|
93
|
+
file_ending=""
|
|
94
|
+
unzip_command=""
|
|
95
|
+
unzip_from_file_option=""
|
|
96
|
+
if [[ ${os} == "windows" ]]; then
|
|
97
|
+
file_ending="zip"
|
|
98
|
+
unzip_command="unzip -d"
|
|
99
|
+
else
|
|
100
|
+
file_ending="tgz"
|
|
101
|
+
unzip_command="tar xz -C"
|
|
102
|
+
unzip_from_file_option="-f"
|
|
103
|
+
fi
|
|
104
|
+
download_url="${release_url}/download/${version}/exercism-${os}-${arch}.${file_ending}"
|
|
105
|
+
|
|
106
|
+
mkdir -p ${exercism_home}
|
|
107
|
+
temp=$(mktemp)
|
|
108
|
+
curl -s --Location ${download_url} > ${temp}
|
|
109
|
+
${unzip_command} ${exercism_home} ${unzip_from_file_option} ${temp}
|
|
110
|
+
|
|
111
|
+
## Configuration
|
|
112
|
+
config_file=".journy-test.exercism.json"
|
|
113
|
+
port=9292
|
|
114
|
+
|
|
115
|
+
exercism_command="./exercism --config ${config_file}"
|
|
116
|
+
|
|
117
|
+
pushd ${exercism_home}
|
|
118
|
+
${exercism_command} configure --dir="${exercism_home}"
|
|
119
|
+
${exercism_command} configure --api "http://localhost:${port}"
|
|
120
|
+
${exercism_command} debug
|
|
121
|
+
popd
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
set -x
|
|
4
|
+
|
|
5
|
+
path=$HOME/.local/bin
|
|
6
|
+
stack_bin=$path/stack
|
|
7
|
+
|
|
8
|
+
mkdir -p $path
|
|
9
|
+
export PATH=$path:$PATH
|
|
10
|
+
|
|
11
|
+
[[ -f $stack_bin ]] || curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C $path '*/stack'
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
set -x
|
|
4
|
+
|
|
5
|
+
xtrack_home=$(pwd)
|
|
6
|
+
build=${xtrack_home}/build
|
|
7
|
+
exercism_home=${build}/exercism
|
|
8
|
+
config_file=".journy-test.exercism.json"
|
|
9
|
+
exercism_command="./exercism --config ${config_file}"
|
|
10
|
+
|
|
11
|
+
exercises=$(ls exercises | sed 's|/||g')
|
|
12
|
+
total_exercises=$(echo ${exercises} | wc -w)
|
|
13
|
+
current_exercise_number=1
|
|
14
|
+
|
|
15
|
+
pushd ${exercism_home}
|
|
16
|
+
|
|
17
|
+
green=()
|
|
18
|
+
red=()
|
|
19
|
+
exit_code=0
|
|
20
|
+
|
|
21
|
+
for exercise in $exercises; do
|
|
22
|
+
percentage=$(((current_exercise_number - 1) * 100 / total_exercises))
|
|
23
|
+
set +x
|
|
24
|
+
echo -e "\n\n"
|
|
25
|
+
echo "============================================="
|
|
26
|
+
echo "${current_exercise_number} of ${total_exercises} (${percentage}) -- ${exercise}"
|
|
27
|
+
echo "============================================="
|
|
28
|
+
set -x
|
|
29
|
+
|
|
30
|
+
${exercism_command} fetch idris ${exercise} # TODO: track name!
|
|
31
|
+
exercise_implementation=$(ls ${exercism_home}/idris/${exercise}/src/*.idr)
|
|
32
|
+
exercise_example=${xtrack_home}/exercises/${exercise}/src/example.idr
|
|
33
|
+
cp ${exercise_example} ${exercise_implementation}
|
|
34
|
+
|
|
35
|
+
pushd ${exercism_home}/idris/${exercise}
|
|
36
|
+
if make test; then
|
|
37
|
+
green+=(${exercise})
|
|
38
|
+
else
|
|
39
|
+
red+=(${exercise})
|
|
40
|
+
exit_code=$((exit_code + 1))
|
|
41
|
+
fi
|
|
42
|
+
popd
|
|
43
|
+
|
|
44
|
+
current_exercise_number=$((current_exercise_number + 1))
|
|
45
|
+
done
|
|
46
|
+
|
|
47
|
+
set +x
|
|
48
|
+
|
|
49
|
+
echo "GOOD:"
|
|
50
|
+
for i in ${green[@]}; do
|
|
51
|
+
echo " * ${i}"
|
|
52
|
+
done
|
|
53
|
+
|
|
54
|
+
echo -e "\n\nBAD:"
|
|
55
|
+
for i in ${red[@]}; do
|
|
56
|
+
echo " * ${i}"
|
|
57
|
+
done
|
|
58
|
+
|
|
59
|
+
exit $exit_code
|