Skip to content

Commit 2813b3a

Browse files
Bringing your track in line with the latest changes to Problem Specifications (#868)
* Add tests.toml file for all exercises with canonical data * Prepare for merging tests.toml - Update CONTIBUTING guide - Update dependencies in root - Update fetch-configlet script - Add fetch-configlet.ps1 for PowerShell - Add fetch-canonical_data_syncer scripts * Make binary files executable * Update all the packages * Fix lack of paging issue with big PRs * Temporary stop-gap measure to load the full (maximum) page * Sync again * Update grep to work cross-env Fixes #878 - Normalise paths - Add helper functions to stub so the student doesn't need to figure this out - Add track insert hint into the README that clarifies how `grep` can be called using node Co-authored-by: Derk-Jan Karrenbeld <derk-jan+github@karrenbeld.info>
1 parent 045454d commit 2813b3a

234 files changed

Lines changed: 7641 additions & 4208 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.js.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313

1414
steps:
1515
- uses: actions/checkout@v2
16-
- name: Use Node.js LTS
16+
- name: Use Node.js LTS (14.x)
1717
uses: actions/setup-node@v1
1818
with:
19-
node-version: 12.x
19+
node-version: 14.x
2020

2121
- name: Install project dependencies
2222
run: npm ci
@@ -29,7 +29,7 @@ jobs:
2929

3030
strategy:
3131
matrix:
32-
node-version: [10.x, 12.x, 14.x]
32+
node-version: [12.x, 14.x, 15.x]
3333

3434
steps:
3535
- uses: actions/checkout@v2

.github/workflows/pr.ci.js.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ jobs:
1313
- name: Checkout PR
1414
uses: actions/checkout@v2
1515

16-
- name: Use Node.js LTS (12.x)
16+
- name: Use Node.js LTS (14.x)
1717
uses: actions/setup-node@v1
1818
with:
19-
node-version: 12.x
19+
node-version: 14.x
2020

2121
- name: Install project dependencies
2222
run: npm ci
2323

2424
- name: Run exercism/javascript ci precheck (stub files, config integrity) for changed exercises
2525
run: |
2626
PULL_REQUEST_URL=$(jq -r ".pull_request.url" "$GITHUB_EVENT_PATH")
27-
curl --url $"${PULL_REQUEST_URL}/files" --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | \
27+
curl --url $"${PULL_REQUEST_URL}/files?per_page=100" --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | \
2828
jq -c '.[] | select(.status == "added" or .status == "modified") | select(.filename | match("\\.(js|jsx|md|json)$")) | .filename' | \
2929
xargs -r npx babel-node scripts/pr-check
3030
@@ -33,7 +33,7 @@ jobs:
3333

3434
strategy:
3535
matrix:
36-
node-version: [10.x, 12.x, 14.x]
36+
node-version: [12.x, 14.x, 15.x]
3737

3838
steps:
3939
- name: Checkout PR

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
# Platform specific tools (use fetch-configlet)
66
bin/configlet
77
bin/configlet.exe
8+
bin/canonical_data_syncer
9+
bin/canonical_data_syncer.exe
810

911
# IDE folders and files
1012
.idea

CONTRIBUTING.md

Lines changed: 101 additions & 105 deletions
Large diffs are not rendered by default.

bin/fetch-canonical_data_syncer

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
set -eo pipefail
4+
5+
readonly LATEST='https://api.github.com/repos/exercism/canonical-data-syncer/releases/latest'
6+
7+
case "$(uname)" in
8+
(Darwin*) OS='mac' ;;
9+
(Linux*) OS='linux' ;;
10+
(Windows*) OS='windows' ;;
11+
(MINGW*) OS='windows' ;;
12+
(MSYS_NT-*) OS='windows' ;;
13+
(*) OS='linux' ;;
14+
esac
15+
16+
case "$OS" in
17+
(windows*) EXT='zip' ;;
18+
(*) EXT='tgz' ;;
19+
esac
20+
21+
case "$(uname -m)" in
22+
(*64*) ARCH='64bit' ;;
23+
(*686*) ARCH='32bit' ;;
24+
(*386*) ARCH='32bit' ;;
25+
(*) ARCH='64bit' ;;
26+
esac
27+
28+
if [ -z "${GITHUB_TOKEN}" ]
29+
then
30+
HEADER=''
31+
else
32+
HEADER="authorization: Bearer ${GITHUB_TOKEN}"
33+
fi
34+
35+
FILENAME="canonical_data_syncer-${OS}-${ARCH}.${EXT}"
36+
37+
get_url () {
38+
curl --header "$HEADER" -s "$LATEST" |
39+
awk -v filename=$FILENAME '$1 ~ /browser_download_url/ && $2 ~ filename { print $2 }' |
40+
tr -d '"'
41+
}
42+
43+
URL=$(get_url)
44+
45+
case "$EXT" in
46+
(*zip)
47+
curl --header "$HEADER" -s --location "$URL" -o bin/latest-canonical_data_syncer.zip
48+
unzip bin/latest-canonical_data_syncer.zip -d bin/
49+
rm bin/latest-canonical_data_syncer.zip
50+
;;
51+
(*) curl --header "$HEADER" -s --location "$URL" | tar xz -C bin/ ;;
52+
esac
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Function DownloadUrl ([string] $FileName, $Headers) {
2+
$latestUrl = "https://api.github.com/repos/exercism/canonical-data-syncer/releases/latest"
3+
$json = Invoke-RestMethod -Headers $Headers -Uri $latestUrl
4+
$json.assets | Where-Object { $_.browser_download_url -match $FileName } | Select-Object -ExpandProperty browser_download_url
5+
}
6+
7+
Function Headers {
8+
If ($GITHUB_TOKEN) { @{ Authorization = "Bearer ${GITHUB_TOKEN}" } } Else { @{ } }
9+
}
10+
11+
Function Arch {
12+
If ([Environment]::Is64BitOperatingSystem) { "64bit" } Else { "32bit" }
13+
}
14+
15+
$arch = Arch
16+
$headers = Headers
17+
$fileName = "canonical_data_syncer-windows-$arch.zip"
18+
$outputDirectory = "bin"
19+
$outputFile = Join-Path -Path $outputDirectory -ChildPath $fileName
20+
$zipUrl = DownloadUrl -FileName $fileName -Headers $headers
21+
22+
Invoke-WebRequest -Headers $headers -Uri $zipUrl -OutFile $outputFile
23+
Expand-Archive $outputFile -DestinationPath $outputDirectory -Force
24+
Remove-Item -Path $outputFile

bin/fetch-configlet

Lines changed: 50 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,52 @@
1-
#!/bin/bash
2-
3-
LATEST=https://github.com/exercism/configlet/releases/latest
4-
5-
OS=$(
6-
case $(uname) in
7-
(Darwin*)
8-
echo "mac";;
9-
(Linux*)
10-
echo "linux";;
11-
(Windows*)
12-
echo "windows";;
13-
(MINGW*)
14-
echo "windows";;
15-
(*)
16-
echo "linux";;
17-
esac)
18-
19-
EXT=$(
20-
case $OS in
21-
(windows*)
22-
echo "zip";;
23-
(*)
24-
echo "tgz";;
25-
esac)
26-
27-
ARCH=$(
28-
case $(uname -m) in
29-
(*64*)
30-
echo 64bit;;
31-
(*686*)
32-
echo 32bit;;
33-
(*386*)
34-
echo 32bit;;
35-
(*)
36-
echo 64bit;;
37-
esac)
38-
39-
40-
VERSION="$(curl --silent --head $LATEST | awk -v FS=/ '/location:/{print $NF}' | tr -d '\r')"
41-
URL=https://github.com/exercism/configlet/releases/download/$VERSION/configlet-$OS-${ARCH}.$EXT
42-
43-
case $EXT in
1+
#!/usr/bin/env bash
2+
3+
set -eo pipefail
4+
5+
readonly LATEST='https://api.github.com/repos/exercism/configlet/releases/latest'
6+
7+
case "$(uname)" in
8+
(Darwin*) OS='mac' ;;
9+
(Linux*) OS='linux' ;;
10+
(Windows*) OS='windows' ;;
11+
(MINGW*) OS='windows' ;;
12+
(MSYS_NT-*) OS='windows' ;;
13+
(*) OS='linux' ;;
14+
esac
15+
16+
case "$OS" in
17+
(windows*) EXT='zip' ;;
18+
(*) EXT='tgz' ;;
19+
esac
20+
21+
case "$(uname -m)" in
22+
(*64*) ARCH='64bit' ;;
23+
(*686*) ARCH='32bit' ;;
24+
(*386*) ARCH='32bit' ;;
25+
(*) ARCH='64bit' ;;
26+
esac
27+
28+
if [ -z "${GITHUB_TOKEN}" ]
29+
then
30+
HEADER=''
31+
else
32+
HEADER="authorization: Bearer ${GITHUB_TOKEN}"
33+
fi
34+
35+
FILENAME="configlet-${OS}-${ARCH}.${EXT}"
36+
37+
get_url () {
38+
curl --header "$HEADER" -s "$LATEST" |
39+
awk -v filename=$FILENAME '$1 ~ /browser_download_url/ && $2 ~ filename { print $2 }' |
40+
tr -d '"'
41+
}
42+
43+
URL=$(get_url)
44+
45+
case "$EXT" in
4446
(*zip)
45-
curl -s --location $URL -o bin/latest-configlet.zip
47+
curl --header "$HEADER" -s --location "$URL" -o bin/latest-configlet.zip
4648
unzip bin/latest-configlet.zip -d bin/
47-
rm bin/latest-configlet.zip;;
48-
(*)
49-
curl -s --location $URL | tar xz -C bin/;;
50-
esac
49+
rm bin/latest-configlet.zip
50+
;;
51+
(*) curl --header "$HEADER" -s --location "$URL" | tar xz -C bin/ ;;
52+
esac

bin/fetch-configlet.ps1

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Function DownloadUrl ([string] $FileName, $Headers) {
2+
$latestUrl = "https://api.github.com/repos/exercism/configlet/releases/latest"
3+
$json = Invoke-RestMethod -Headers $Headers -Uri $latestUrl
4+
$json.assets | Where-Object { $_.browser_download_url -match $FileName } | Select-Object -ExpandProperty browser_download_url
5+
}
6+
7+
Function Headers {
8+
If ($GITHUB_TOKEN) { @{ Authorization = "Bearer ${GITHUB_TOKEN}" } } Else { @{ } }
9+
}
10+
11+
Function Arch {
12+
If ([Environment]::Is64BitOperatingSystem) { "64bit" } Else { "32bit" }
13+
}
14+
15+
$arch = Arch
16+
$headers = Headers
17+
$fileName = "configlet-windows-$arch.zip"
18+
$outputDirectory = "bin"
19+
$outputFile = Join-Path -Path $outputDirectory -ChildPath $fileName
20+
$zipUrl = DownloadUrl -FileName $fileName -Headers $headers
21+
22+
Invoke-WebRequest -Headers $headers -Uri $zipUrl -OutFile $outputFile
23+
Expand-Archive $outputFile -DestinationPath $outputDirectory -Force
24+
Remove-Item -Path $outputFile

bin/generate-config-tree

100644100755
File mode changed.

bin/print-config-tree

100644100755
File mode changed.

0 commit comments

Comments
 (0)