trackler 2.2.1.130 → 2.2.1.131

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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/crypto-square/description.md +4 -5
  4. data/problem-specifications/exercises/isbn-verifier/canonical-data.json +9 -1
  5. data/problem-specifications/exercises/kindergarten-garden/canonical-data.json +1 -4
  6. data/tracks/csharp/build.ps1 +46 -130
  7. data/tracks/csharp/build.sh +21 -70
  8. data/tracks/ecmascript/exercises/simple-cipher/simple-cipher.spec.js +14 -0
  9. data/tracks/fsharp/build.ps1 +46 -130
  10. data/tracks/fsharp/build.sh +21 -70
  11. data/tracks/fsharp/exercises/bank-account/BankAccountTest.fs +13 -12
  12. data/tracks/fsharp/exercises/bank-account/Example.fs +2 -2
  13. data/tracks/fsharp/exercises/grade-school/.meta/hints.md +1 -0
  14. data/tracks/fsharp/exercises/grade-school/GradeSchool.fs +6 -4
  15. data/tracks/fsharp/exercises/zipper/ZipperTest.fs +79 -26
  16. data/tracks/fsharp/generators/Common.fs +2 -0
  17. data/tracks/fsharp/generators/Generators.fs +100 -0
  18. data/tracks/java/exercises/house/.meta/src/reference/java/House.java +2 -2
  19. data/tracks/java/exercises/house/.meta/version +1 -1
  20. data/tracks/java/exercises/house/src/test/java/HouseTest.java +157 -172
  21. data/tracks/java/exercises/rectangles/.meta/version +1 -1
  22. data/tracks/java/exercises/rectangles/src/test/java/RectangleCounterTest.java +9 -1
  23. data/tracks/javascript/exercises/bob/bob.spec.js +1 -1
  24. data/tracks/javascript/exercises/bob/example.js +3 -0
  25. data/tracks/javascript/exercises/simple-cipher/simple-cipher.spec.js +14 -0
  26. data/tracks/julia/config.json +2 -2
  27. data/tracks/julia/exercises/nucleotide-count/example.jl +1 -1
  28. data/tracks/julia/exercises/nucleotide-count/runtests.jl +1 -1
  29. data/tracks/perl5/.travis.yml +1 -4
  30. data/tracks/perl5/exercises/food-chain/.meta/solutions/FoodChainSong.pm +1 -0
  31. data/tracks/perl5/exercises/pascals-triangle/.meta/solutions/Triangle.pm +1 -0
  32. data/tracks/perl5/exercises/pig-latin/.meta/solutions/PigLatin.pm +1 -0
  33. data/tracks/perl5/exercises/robot-simulator/.meta/solutions/Robot.pm +1 -0
  34. data/tracks/python/config.json +15 -0
  35. data/tracks/python/exercises/bowling/bowling_test.py +1 -1
  36. data/tracks/python/exercises/bracket-push/bracket_push_test.py +4 -1
  37. data/tracks/python/exercises/isbn-verifier/isbn_verifier_test.py +5 -2
  38. data/tracks/python/exercises/yacht/README.md +85 -0
  39. data/tracks/python/exercises/yacht/example.py +65 -0
  40. data/tracks/python/exercises/yacht/yacht.py +18 -0
  41. data/tracks/python/exercises/yacht/yacht_test.py +90 -0
  42. data/tracks/typescript/config.json +25 -0
  43. data/tracks/typescript/exercises/complex-numbers/README.md +64 -0
  44. data/tracks/typescript/exercises/complex-numbers/complex-numbers.example.ts +45 -0
  45. data/tracks/typescript/exercises/complex-numbers/complex-numbers.test.ts +216 -0
  46. data/tracks/typescript/exercises/complex-numbers/complex-numbers.ts +0 -0
  47. data/tracks/typescript/exercises/complex-numbers/package.json +36 -0
  48. data/tracks/typescript/exercises/complex-numbers/tsconfig.json +22 -0
  49. data/tracks/typescript/exercises/complex-numbers/tslint.json +127 -0
  50. data/tracks/typescript/exercises/complex-numbers/yarn.lock +2624 -0
  51. data/tracks/typescript/exercises/minesweeper/README.md +55 -0
  52. data/tracks/typescript/exercises/minesweeper/minesweeper.example.ts +58 -0
  53. data/tracks/typescript/exercises/minesweeper/minesweeper.test.ts +173 -0
  54. data/tracks/typescript/exercises/minesweeper/minesweeper.ts +0 -0
  55. data/tracks/typescript/exercises/minesweeper/package.json +36 -0
  56. data/tracks/typescript/exercises/minesweeper/tsconfig.json +22 -0
  57. data/tracks/typescript/exercises/minesweeper/tslint.json +127 -0
  58. data/tracks/typescript/exercises/minesweeper/yarn.lock +2624 -0
  59. data/tracks/typescript/exercises/simple-cipher/simple-cipher.test.ts +14 -0
  60. metadata +22 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 923eff384744b6182eb32fb442de07be36209106
4
- data.tar.gz: '02753792b8af2f08857952bb33d769096c5f8bd0'
3
+ metadata.gz: 8b2e1ba3f3af22decf9f03ccb9bc3417246da1f4
4
+ data.tar.gz: 4b348ef49dcd73c7dd8249a7bd686693358b98d7
5
5
  SHA512:
6
- metadata.gz: 418bfe90ffbb922d431bb20b9dd0df31c74bf29ec568e7d84474f91aba5e9ff405b5bd3ffaf9592e0f70506a14a93c0ebe058fdc38fa4a7f65e1f67b04ac64e5
7
- data.tar.gz: 8abdcc2a182bca4ec7a7aaf54a40049a02a2ba1d07354580d980172fb416771fcf559cdf3f9a5da1ede3ffe6b33c78e5467e1c0609ebe4b237dd8f98096ea98a
6
+ metadata.gz: 6cc2ecafb9edbed7f8113eda045d4118afe44b8649e353aea6403b4a8f00f534b524a9d77f48ee40992696be98312d1a3e8cd205a603daffd333d7e7c6117faa
7
+ data.tar.gz: c04c86adf4afdba89a4a3b3fbd5e0fd8b006c4affa358dc5977eea660c7846e88196c155807976ff3f8e626a37d8ca98244e534bae96c1b7232c2b0a49c30921
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.2.1.130"
2
+ VERSION = "2.2.1.131"
3
3
  end
@@ -43,11 +43,10 @@ The message above is coded as:
43
43
  imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau
44
44
  ```
45
45
 
46
- Output the encoded text in chunks. Phrases that fill perfect rectangles
47
- `(r X c)` should be output `c` chunks of `r` length, separated by spaces.
48
- Phrases that do not fill perfect rectangles will have `n` empty spaces.
49
- Those spaces should be distributed evenly, added to the end of the last
50
- `n` chunks.
46
+ Output the encoded text in chunks that fill perfect rectangles `(r X c)`,
47
+ with `c` chunks of `r` length, separated by spaces. For phrases that are
48
+ `n` characters short of the perfect rectangle, pad each of the last `n`
49
+ chunks with a single trailing space.
51
50
 
52
51
  ```text
53
52
  imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "exercise": "isbn-verifier",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "comments": [
5
5
  "An expected value of true indicates a valid ISBN-10, ",
6
6
  "whereas false means the ISBN-10 is invalid."
@@ -117,6 +117,14 @@
117
117
  "isbn": ""
118
118
  },
119
119
  "expected": false
120
+ },
121
+ {
122
+ "description": "input is 9 characters",
123
+ "property": "isValid",
124
+ "input": {
125
+ "isbn": "134456729"
126
+ },
127
+ "expected": false
120
128
  }
121
129
  ]
122
130
  }
@@ -1,9 +1,6 @@
1
1
  {
2
2
  "exercise": "kindergarten-garden",
3
- "version": "1.1.0",
4
- "comments": [
5
- "Garden can be created with just a diagram or a diagram and students."
6
- ],
3
+ "version": "1.1.1",
7
4
  "cases": [
8
5
  {
9
6
  "description": "partial garden",
@@ -1,149 +1,65 @@
1
1
  <#
2
2
  .SYNOPSIS
3
- This is a Powershell script to bootstrap a Cake build.
3
+ Build and test the Exercism C# exercises.
4
4
  .DESCRIPTION
5
- This Powershell script will download NuGet if missing, restore NuGet tools (including Cake)
6
- and execute your Cake build script with the parameters you provide.
7
- .PARAMETER Target
8
- The build script target to run.
9
- .PARAMETER Configuration
10
- The build configuration to use.
11
- .PARAMETER Verbosity
12
- Specifies the amount of information to be displayed.
13
- .PARAMETER WhatIf
14
- Performs a dry run of the build script.
15
- No tasks will be executed.
5
+ This script runs the Cake build.cake script, which does the following:
6
+ - Build each exercise's project.
7
+ - Run the exercise's tests against the example implementation.
8
+ - Run the refactoring tests against the default implementation.
16
9
  .PARAMETER Exercise
17
- The exercise to build and test. If not specified, all exercises will be built and tested.
18
- .PARAMETER ScriptArgs
19
- Remaining arguments are added here.
10
+ The name of the exercise to build.
11
+ .EXAMPLE
12
+ .\build.ps1
13
+ Build and test all exercises
14
+ .EXAMPLE
15
+ .\build.ps1 -Exercise anagram
16
+ Build and test only the anagram exercise
20
17
  .LINK
21
- http://cakebuild.net
18
+ https://github.com/exercism/csharp
22
19
  #>
23
-
24
20
  [CmdletBinding()]
25
21
  Param(
26
- [string]$Target = "Default",
27
- [ValidateSet("Release", "Debug")]
28
- [string]$Configuration = "Release",
29
- [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
30
- [string]$Verbosity = "Normal",
31
- [switch]$WhatIf,
32
- [string]$Exercise,
33
- [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
34
- [string[]]$ScriptArgs
22
+ [Parameter(Mandatory=$false)]
23
+ [string]$Exercise
35
24
  )
36
25
 
37
- function GetProxyEnabledWebClient
26
+ $SCRIPT_DIR = $PSScriptRoot
27
+ $TOOLS_DIR = Join-Path $SCRIPT_DIR "tools"
28
+ $CAKE_VERSION = "0.26.1"
29
+ $CAKE_DIR = Join-Path $TOOLS_DIR "Cake.$CAKE_VERSION"
30
+ $CAKE_DLL = Join-Path $CAKE_DIR "Cake.dll"
31
+ $CAKE_ZIP = Join-Path $TOOLS_DIR "Cake.$CAKE_VERSION.zip"
32
+ $CAKE_ZIP_URL = "https://github.com/cake-build/cake/releases/download/v0.26.1/Cake-bin-coreclr-v$CAKE_VERSION.zip"
33
+ $DOTNET_VERSION = "2.0.3"
34
+ $DOTNET_DIR = Join-Path $TOOLS_DIR "dotnet.$DOTNET_VERSION"
35
+ $DOTNET_COMMAND = Join-Path $DOTNET_DIR "dotnet.exe"
36
+ $DOTNET_INSTALL_SCRIPT = Join-Path $DOTNET_DIR "dotnet-install.ps1"
37
+ $DOTNET_INSTALL_SCRIPT_URL = "https://dot.net/v1/dotnet-install.ps1"
38
+
39
+ function DownloadFile([string] $Url, [string] $Path)
38
40
  {
39
- $wc = New-Object System.Net.WebClient
40
- $proxy = [System.Net.WebRequest]::GetSystemWebProxy()
41
- $proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
42
- $wc.Proxy = $proxy
43
- return $wc
44
- }
45
-
46
- Write-Host "Preparing to run build script..."
47
-
48
- if(!$PSScriptRoot){
49
- $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
50
- }
51
-
52
- $TOOLS_DIR = Join-Path $PSScriptRoot "tools"
53
- $NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
54
- $NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
55
- $CAKE_VERSION = "0.21.1"
56
- $CAKE_DLL = Join-Path $TOOLS_DIR "Cake.CoreCLR.$CAKE_VERSION/Cake.dll"
57
- $DOTNET_DIR = Join-Path $PSScriptRoot ".dotnet"
58
- $DOTNET_CORE_2_VERSION = "2.0.0"
59
- $DOTNET_CORE_1_VERSION = "1.0.4"
60
- $DOTNET_INSTALLER_SCRIPT_URL = "https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.ps1"
61
- $DOTNET_INSTALLER_SCRIPT = Join-Path $DOTNET_DIR "dotnet-install.ps1"
62
-
63
- $env:PATH = "$TOOLS_DIR;$DOTNET_DIR;$env:PATH"
64
-
65
- # Make sure tools folder exists
66
- if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
67
- Write-Verbose -Message "Creating tools directory..."
68
- New-Item -Path $TOOLS_DIR -Type directory | out-null
69
- }
70
-
71
- # Make sure dotnet folder exists
72
- if ((Test-Path $PSScriptRoot) -and !(Test-Path $DOTNET_DIR)) {
73
- Write-Verbose -Message "Creating .dotnet directory..."
74
- New-Item -Path $DOTNET_DIR -Type directory | out-null
75
- }
76
-
77
- # Try download .NET installer script if not exists
78
- if (!(Test-Path $DOTNET_INSTALLER_SCRIPT)) {
79
- Write-Verbose -Message "Downloading .NET installer script..."
80
- try {
81
- $wc = GetProxyEnabledWebClient
82
- $wc.DownloadFile($DOTNET_INSTALLER_SCRIPT_URL, $DOTNET_INSTALLER_SCRIPT)
83
- } catch {
84
- Throw "Could not download .NET installer script."
85
- }
86
- }
87
-
88
- # Install .NET Core runtimes
89
- Invoke-Expression "&`"$DOTNET_INSTALLER_SCRIPT`" -Version $DOTNET_CORE_1_VERSION -InstallDir `"$DOTNET_DIR`""
90
- Invoke-Expression "&`"$DOTNET_INSTALLER_SCRIPT`" -Version $DOTNET_CORE_2_VERSION -InstallDir `"$DOTNET_DIR`""
91
- $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
92
- $env:DOTNET_CLI_TELEMETRY_OPTOUT=1
93
-
94
- # Try find NuGet.exe in path if not exists
95
- if (!(Test-Path $NUGET_EXE)) {
96
- Write-Verbose -Message "Trying to find nuget.exe in PATH..."
97
- $existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_ -PathType Container) }
98
- $NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1
99
- if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) {
100
- Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)."
101
- $NUGET_EXE = $NUGET_EXE_IN_PATH.FullName
102
- }
103
- }
104
-
105
- # Try download NuGet.exe if not exists
106
- if (!(Test-Path $NUGET_EXE)) {
107
- Write-Verbose -Message "Downloading NuGet.exe..."
108
- try {
109
- $wc = GetProxyEnabledWebClient
110
- $wc.DownloadFile($NUGET_URL, $NUGET_EXE)
111
- } catch {
112
- Throw "Could not download NuGet.exe."
113
- }
41
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
42
+ $webClient = New-Object System.Net.WebClient
43
+ $webClient.Proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
44
+ $webClient.DownloadFile($Url, $Path)
114
45
  }
115
46
 
116
- # Save nuget.exe path to environment to be available to child processed
117
- $ENV:NUGET_EXE = $NUGET_EXE
118
-
119
- # Try install Cake
47
+ # Ensure Cake is installed
120
48
  if (!(Test-Path $CAKE_DLL)) {
121
- Write-Verbose -Message "Installing Cake..."
122
- $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install Cake.CoreCLR -Version $CAKE_VERSION -OutputDirectory `"$TOOLS_DIR`""
123
-
124
- if ($LASTEXITCODE -ne 0) {
125
- Throw "Could not install Cake."
126
- }
127
-
128
- Write-Verbose -Message ($NuGetOutput | out-string)
49
+ New-Item -ItemType Directory -Force -Path $CAKE_DIR | Out-Null
50
+ DownloadFile -Url $CAKE_ZIP_URL -Path $CAKE_ZIP
51
+ Expand-Archive $CAKE_ZIP -DestinationPath $CAKE_DIR | Out-Null
52
+ Remove-Item -Force -Path $CAKE_ZIP | Out-Null
129
53
  }
130
54
 
131
- # Make sure that Cake has been installed
132
- if (!(Test-Path $CAKE_DLL)) {
133
- Throw "Could not find Cake.dll at $CAKE_DLL"
55
+ # Ensure .NET Core runtime is installed
56
+ if (!(Test-Path $DOTNET_COMMAND)) {
57
+ New-Item -ItemType Directory -Force -Path $DOTNET_DIR | Out-Null
58
+ DownloadFile -Url $DOTNET_INSTALL_SCRIPT_URL -Path $DOTNET_INSTALL_SCRIPT
59
+ Invoke-Expression "&`"$DOTNET_INSTALL_SCRIPT`" -Version $DOTNET_VERSION -InstallDir `"$DOTNET_DIR`" -NoPath"
60
+ Remove-Item -Force -Path $DOTNET_INSTALL_SCRIPT | Out-Null
134
61
  }
135
62
 
136
- # Build Cake arguments
137
63
  $cakeArguments = @("$Script");
138
- if ($Target) { $cakeArguments += "-target=$Target" }
139
- if ($Configuration) { $cakeArguments += "-configuration=$Configuration" }
140
- if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" }
141
- if ($ShowDescription) { $cakeArguments += "-showdescription" }
142
- if ($DryRun) { $cakeArguments += "-dryrun" }
143
- if ($Exercise) { $cakeArguments += "-exercise=$Exercise" }
144
- $cakeArguments += $ScriptArgs
145
-
146
- # Start Cake
147
- Write-Host "Running build script..."
148
- Invoke-Expression "&dotnet `"$CAKE_DLL`" $cakeArguments"
149
- exit $LASTEXITCODE
64
+ if ($Exercise) { $cakeArguments += "--exercise=$Exercise" }
65
+ Invoke-Expression "&$DOTNET_COMMAND `"$CAKE_DLL`" $cakeArguments"
@@ -1,82 +1,33 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- # Define directories.
4
3
  SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
5
4
  TOOLS_DIR=$SCRIPT_DIR/tools
6
- CAKE_VERSION=0.21.1
7
- CAKE_DIR=$TOOLS_DIR/Cake.CoreCLR.$CAKE_VERSION
5
+ CAKE_VERSION=0.26.1
6
+ CAKE_DIR=$TOOLS_DIR/Cake.$CAKE_VERSION
8
7
  CAKE_DLL=$CAKE_DIR/Cake.dll
9
- CAKE_ZIP=$TOOLS_DIR/Cake.CoreCLR.$CAKE_VERSION.zip
10
- CAKE_URL=https://www.nuget.org/api/v2/package/Cake.CoreCLR/$CAKE_VERSION
11
- DOTNET_DIR=$SCRIPT_DIR/.dotnet
12
- DOTNET_CORE_2_VERSION=2.0.0
13
- DOTNET_CORE_1_VERSION=1.0.4
14
- DOTNET_INSTALLER_SCRIPT_URL=https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.sh
15
- DOTNET_INSTALLER_SCRIPT=$DOTNET_DIR/dotnet-install.sh
16
-
17
- # Define default arguments.
18
- TARGET="Default"
19
- CONFIGURATION="Release"
20
- VERBOSITY="Normal"
21
- DRYRUN=
22
- CAKE_ARGUMENTS=()
23
-
24
- # Parse arguments.
25
- for i in "$@"; do
26
- case $1 in
27
- -t|--target) TARGET="$2"; shift ;;
28
- -c|--configuration) CONFIGURATION="$2"; shift ;;
29
- -v|--verbosity) VERBOSITY="$2"; shift ;;
30
- -d|--dryrun) DRYRUN="-dryrun" ;;
31
- --) shift; CAKE_ARGUMENTS+=("$@"); break ;;
32
- *) CAKE_ARGUMENTS+=("$1") ;;
33
- esac
34
- shift
35
- done
36
-
37
- # Make sure the tools folder exist.
38
- if [ ! -d "$TOOLS_DIR" ]; then
39
- mkdir "$TOOLS_DIR"
40
- fi
41
-
42
- # Make sure the dotnet folder exist.
43
- if [ ! -d "$DOTNET_DIR" ]; then
44
- mkdir "$DOTNET_DIR"
45
- fi
46
-
47
- # Download .NET installer script if it does not exist.
48
- if [ ! -f "$DOTNET_INSTALLER_SCRIPT" ]; then
49
- echo "Downloading .NET installer script..."
50
- curl -Lsfo "$DOTNET_INSTALLER_SCRIPT" $DOTNET_INSTALLER_SCRIPT_URL
51
- if [ $? -ne 0 ]; then
52
- echo "An error occured while downloading .NET installer script."
53
- exit 1
54
- fi
55
- fi
56
-
57
- # Install .NET Core runtimes
58
- $DOTNET_INSTALLER_SCRIPT --version $DOTNET_CORE_1_VERSION --install-dir "$DOTNET_DIR" --no-path
59
- $DOTNET_INSTALLER_SCRIPT --version $DOTNET_CORE_2_VERSION --install-dir "$DOTNET_DIR" --no-path
60
- export PATH="$DOTNET_DIR":$PATH
61
- export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
62
- export DOTNET_CLI_TELEMETRY_OPTOUT=1
63
-
64
- # Install Cake
8
+ CAKE_ZIP=$TOOLS_DIR/Cake.$CAKE_VERSION.zip
9
+ CAKE_ZIP_URL=https://github.com/cake-build/cake/releases/download/v0.26.1/Cake-bin-coreclr-v$CAKE_VERSION.zip
10
+ DOTNET_VERSION=2.0.3
11
+ DOTNET_DIR=$TOOLS_DIR/dotnet.$DOTNET_VERSION
12
+ DOTNET_COMMAND=$DOTNET_DIR/dotnet
13
+ DOTNET_INSTALL_SCRIPT=$DOTNET_DIR/dotnet-install.sh
14
+ DOTNET_INSTALL_SCRIPT_URL=https://dot.net/v1/dotnet-install.sh
15
+
16
+ # Ensure Cake is installed
65
17
  if [ ! -f "$CAKE_DLL" ]; then
66
- curl -Lsfo "$CAKE_ZIP" "$CAKE_URL"
18
+ mkdir -p $CAKE_DIR
19
+ curl -Lsfo "$CAKE_ZIP" "$CAKE_ZIP_URL"
67
20
  unzip -q "$CAKE_ZIP" -d "$CAKE_DIR"
68
21
  rm -f "$CAKE_ZIP"
69
- if [ $? -ne 0 ]; then
70
- echo "An error occured while installing Cake."
71
- exit 1
72
- fi
73
22
  fi
74
23
 
75
- # Make sure that Cake has been installed.
76
- if [ ! -f "$CAKE_DLL" ]; then
77
- echo "Could not find Cake.dll at '$CAKE_DLL'."
78
- exit 1
24
+ # Ensure .NET Core runtime is installed
25
+ if [ ! -f "$DOTNET_COMMAND" ]; then
26
+ mkdir -p $DOTNET_DIR
27
+ curl -Lsfo "$DOTNET_INSTALL_SCRIPT" "$DOTNET_INSTALL_SCRIPT_URL"
28
+ chmod u+x $DOTNET_INSTALL_SCRIPT
29
+ $DOTNET_INSTALL_SCRIPT --version $DOTNET_VERSION --install-dir "$DOTNET_DIR" --no-path
30
+ rm -f $DOTNET_INSTALL_SCRIPT
79
31
  fi
80
32
 
81
- # Start Cake
82
- dotnet "$CAKE_DLL" --verbosity="$VERBOSITY" --configuration="$CONFIGURATION" --target="$TARGET" $DRYRUN "${CAKE_ARGUMENTS[@]}"
33
+ $DOTNET_COMMAND "$CAKE_DLL" "$@"
@@ -1,5 +1,15 @@
1
1
  import Cipher from './simple-cipher';
2
2
 
3
+ describe('Random key generation', () => {
4
+ xtest('generates keys at random', () => {
5
+ // Strictly speaking, this is difficult to test with 100% certainty.
6
+ // But, if you have a generator that generates 100-character-long
7
+ // strings of lowercase letters at random, the odds of two consecutively
8
+ // generated keys being identical are astronomically low.
9
+ expect(new Cipher().key).not.toEqual(new Cipher().key);
10
+ });
11
+ });
12
+
3
13
  describe('Random key cipher', () => {
4
14
  const cipher = new Cipher();
5
15
 
@@ -7,6 +17,10 @@ describe('Random key cipher', () => {
7
17
  expect(cipher.key).toMatch(/^[a-z]+$/);
8
18
  });
9
19
 
20
+ xtest('has a key that is at least 100 characters long', () => {
21
+ expect(cipher.key.length).toBeGreaterThanOrEqual(100);
22
+ });
23
+
10
24
  // Here we take advantage of the fact that plaintext of "aaa..."
11
25
  // outputs the key. This is a critical problem with shift ciphers, some
12
26
  // characters will always output the key verbatim.
@@ -1,149 +1,65 @@
1
1
  <#
2
2
  .SYNOPSIS
3
- This is a Powershell script to bootstrap a Cake build.
3
+ Build and test the Exercism F# exercises.
4
4
  .DESCRIPTION
5
- This Powershell script will download NuGet if missing, restore NuGet tools (including Cake)
6
- and execute your Cake build script with the parameters you provide.
7
- .PARAMETER Target
8
- The build script target to run.
9
- .PARAMETER Configuration
10
- The build configuration to use.
11
- .PARAMETER Verbosity
12
- Specifies the amount of information to be displayed.
13
- .PARAMETER WhatIf
14
- Performs a dry run of the build script.
15
- No tasks will be executed.
5
+ This script runs the Cake build.cake script, which does the following:
6
+ - Build each exercise's project.
7
+ - Run the exercise's tests against the example implementation.
8
+ - Run the refactoring tests against the default implementation.
16
9
  .PARAMETER Exercise
17
- The exercise to build and test. If not specified, all exercises will be built and tested.
18
- .PARAMETER ScriptArgs
19
- Remaining arguments are added here.
10
+ The name of the exercise to build.
11
+ .EXAMPLE
12
+ .\build.ps1
13
+ Build and test all exercises
14
+ .EXAMPLE
15
+ .\build.ps1 -Exercise anagram
16
+ Build and test only the anagram exercise
20
17
  .LINK
21
- http://cakebuild.net
18
+ https://github.com/exercism/fsharp
22
19
  #>
23
-
24
20
  [CmdletBinding()]
25
21
  Param(
26
- [string]$Target = "Default",
27
- [ValidateSet("Release", "Debug")]
28
- [string]$Configuration = "Release",
29
- [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
30
- [string]$Verbosity = "Normal",
31
- [switch]$WhatIf,
32
- [string]$Exercise,
33
- [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
34
- [string[]]$ScriptArgs
22
+ [Parameter(Mandatory=$false)]
23
+ [string]$Exercise
35
24
  )
36
25
 
37
- function GetProxyEnabledWebClient
26
+ $SCRIPT_DIR = $PSScriptRoot
27
+ $TOOLS_DIR = Join-Path $SCRIPT_DIR "tools"
28
+ $CAKE_VERSION = "0.26.1"
29
+ $CAKE_DIR = Join-Path $TOOLS_DIR "Cake.$CAKE_VERSION"
30
+ $CAKE_DLL = Join-Path $CAKE_DIR "Cake.dll"
31
+ $CAKE_ZIP = Join-Path $TOOLS_DIR "Cake.$CAKE_VERSION.zip"
32
+ $CAKE_ZIP_URL = "https://github.com/cake-build/cake/releases/download/v0.26.1/Cake-bin-coreclr-v$CAKE_VERSION.zip"
33
+ $DOTNET_VERSION = "2.0.3"
34
+ $DOTNET_DIR = Join-Path $TOOLS_DIR "dotnet.$DOTNET_VERSION"
35
+ $DOTNET_COMMAND = Join-Path $DOTNET_DIR "dotnet.exe"
36
+ $DOTNET_INSTALL_SCRIPT = Join-Path $DOTNET_DIR "dotnet-install.ps1"
37
+ $DOTNET_INSTALL_SCRIPT_URL = "https://dot.net/v1/dotnet-install.ps1"
38
+
39
+ function DownloadFile([string] $Url, [string] $Path)
38
40
  {
39
- $wc = New-Object System.Net.WebClient
40
- $proxy = [System.Net.WebRequest]::GetSystemWebProxy()
41
- $proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
42
- $wc.Proxy = $proxy
43
- return $wc
44
- }
45
-
46
- Write-Host "Preparing to run build script..."
47
-
48
- if(!$PSScriptRoot){
49
- $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
50
- }
51
-
52
- $TOOLS_DIR = Join-Path $PSScriptRoot "tools"
53
- $NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
54
- $NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
55
- $CAKE_VERSION = "0.21.1"
56
- $CAKE_DLL = Join-Path $TOOLS_DIR "Cake.CoreCLR.$CAKE_VERSION/Cake.dll"
57
- $DOTNET_DIR = Join-Path $PSScriptRoot ".dotnet"
58
- $DOTNET_CORE_2_VERSION = "2.0.0"
59
- $DOTNET_CORE_1_VERSION = "1.0.4"
60
- $DOTNET_INSTALLER_SCRIPT_URL = "https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.ps1"
61
- $DOTNET_INSTALLER_SCRIPT = Join-Path $DOTNET_DIR "dotnet-install.ps1"
62
-
63
- $env:PATH = "$TOOLS_DIR;$DOTNET_DIR;$env:PATH"
64
-
65
- # Make sure tools folder exists
66
- if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
67
- Write-Verbose -Message "Creating tools directory..."
68
- New-Item -Path $TOOLS_DIR -Type directory | out-null
69
- }
70
-
71
- # Make sure dotnet folder exists
72
- if ((Test-Path $PSScriptRoot) -and !(Test-Path $DOTNET_DIR)) {
73
- Write-Verbose -Message "Creating .dotnet directory..."
74
- New-Item -Path $DOTNET_DIR -Type directory | out-null
75
- }
76
-
77
- # Try download .NET installer script if not exists
78
- if (!(Test-Path $DOTNET_INSTALLER_SCRIPT)) {
79
- Write-Verbose -Message "Downloading .NET installer script..."
80
- try {
81
- $wc = GetProxyEnabledWebClient
82
- $wc.DownloadFile($DOTNET_INSTALLER_SCRIPT_URL, $DOTNET_INSTALLER_SCRIPT)
83
- } catch {
84
- Throw "Could not download .NET installer script."
85
- }
86
- }
87
-
88
- # Install .NET Core runtimes
89
- Invoke-Expression "&`"$DOTNET_INSTALLER_SCRIPT`" -Version $DOTNET_CORE_1_VERSION -InstallDir `"$DOTNET_DIR`""
90
- Invoke-Expression "&`"$DOTNET_INSTALLER_SCRIPT`" -Version $DOTNET_CORE_2_VERSION -InstallDir `"$DOTNET_DIR`""
91
- $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
92
- $env:DOTNET_CLI_TELEMETRY_OPTOUT=1
93
-
94
- # Try find NuGet.exe in path if not exists
95
- if (!(Test-Path $NUGET_EXE)) {
96
- Write-Verbose -Message "Trying to find nuget.exe in PATH..."
97
- $existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_ -PathType Container) }
98
- $NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1
99
- if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) {
100
- Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)."
101
- $NUGET_EXE = $NUGET_EXE_IN_PATH.FullName
102
- }
103
- }
104
-
105
- # Try download NuGet.exe if not exists
106
- if (!(Test-Path $NUGET_EXE)) {
107
- Write-Verbose -Message "Downloading NuGet.exe..."
108
- try {
109
- $wc = GetProxyEnabledWebClient
110
- $wc.DownloadFile($NUGET_URL, $NUGET_EXE)
111
- } catch {
112
- Throw "Could not download NuGet.exe."
113
- }
41
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
42
+ $webClient = New-Object System.Net.WebClient
43
+ $webClient.Proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
44
+ $webClient.DownloadFile($Url, $Path)
114
45
  }
115
46
 
116
- # Save nuget.exe path to environment to be available to child processed
117
- $ENV:NUGET_EXE = $NUGET_EXE
118
-
119
- # Try install Cake
47
+ # Ensure Cake is installed
120
48
  if (!(Test-Path $CAKE_DLL)) {
121
- Write-Verbose -Message "Installing Cake..."
122
- $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install Cake.CoreCLR -Version $CAKE_VERSION -OutputDirectory `"$TOOLS_DIR`""
123
-
124
- if ($LASTEXITCODE -ne 0) {
125
- Throw "Could not install Cake."
126
- }
127
-
128
- Write-Verbose -Message ($NuGetOutput | out-string)
49
+ New-Item -ItemType Directory -Force -Path $CAKE_DIR | Out-Null
50
+ DownloadFile -Url $CAKE_ZIP_URL -Path $CAKE_ZIP
51
+ Expand-Archive $CAKE_ZIP -DestinationPath $CAKE_DIR | Out-Null
52
+ Remove-Item -Force -Path $CAKE_ZIP | Out-Null
129
53
  }
130
54
 
131
- # Make sure that Cake has been installed
132
- if (!(Test-Path $CAKE_DLL)) {
133
- Throw "Could not find Cake.dll at $CAKE_DLL"
55
+ # Ensure .NET Core runtime is installed
56
+ if (!(Test-Path $DOTNET_COMMAND)) {
57
+ New-Item -ItemType Directory -Force -Path $DOTNET_DIR | Out-Null
58
+ DownloadFile -Url $DOTNET_INSTALL_SCRIPT_URL -Path $DOTNET_INSTALL_SCRIPT
59
+ Invoke-Expression "&`"$DOTNET_INSTALL_SCRIPT`" -Version $DOTNET_VERSION -InstallDir `"$DOTNET_DIR`" -NoPath"
60
+ Remove-Item -Force -Path $DOTNET_INSTALL_SCRIPT | Out-Null
134
61
  }
135
62
 
136
- # Build Cake arguments
137
63
  $cakeArguments = @("$Script");
138
- if ($Target) { $cakeArguments += "-target=$Target" }
139
- if ($Configuration) { $cakeArguments += "-configuration=$Configuration" }
140
- if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" }
141
- if ($ShowDescription) { $cakeArguments += "-showdescription" }
142
- if ($DryRun) { $cakeArguments += "-dryrun" }
143
- if ($Exercise) { $cakeArguments += "-exercise=$Exercise" }
144
- $cakeArguments += $ScriptArgs
145
-
146
- # Start Cake
147
- Write-Host "Running build script..."
148
- Invoke-Expression "&dotnet `"$CAKE_DLL`" $cakeArguments"
149
- exit $LASTEXITCODE
64
+ if ($Exercise) { $cakeArguments += "--exercise=$Exercise" }
65
+ Invoke-Expression "&$DOTNET_COMMAND `"$CAKE_DLL`" $cakeArguments"