Initial framework commit

This commit is contained in:
Ingy döt Net 2023-06-28 13:59:20 -04:00
commit 72d218235f
14 changed files with 2403 additions and 0 deletions

29
bin/rcd-api-list-all-langs Executable file
View file

@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -e -u -o pipefail
params=(
action=query
list=categorymembers
cmtitle=Category%3AProgramming_Languages
cmprop=title
cmlimit=1500
format=json
)
url=https://rosettacode.org/w/api.php?$(IFS='&'; echo "${params[*]}")
more=''
while true; do
json=$(curl -s "$url$more")
<<<"$json" jq -r '.query .categorymembers | .[] .title' |
grep -E '^Category:[.a-zA-Z0-9]' |
sed 's/^Category://'
cmcontinue=$(<<<"$json" jq -r .continue.cmcontinue)
[[ $cmcontinue == null ]] && break
more="&cmcontinue=$cmcontinue"
done

27
bin/rcd-api-list-all-tasks Executable file
View file

@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -e -u -o pipefail
params=(
action=query
list=categorymembers
cmtitle=Category%3AProgramming_Tasks
cmprop=title
cmlimit=1500
format=json
)
url=https://rosettacode.org/w/api.php?$(IFS='&'; echo "${params[*]}")
more=''
while true; do
json=$(curl -s "$url$more")
<<<"$json" jq -r '.query .categorymembers | .[] .title'
cmcontinue=$(<<<"$json" jq -r .continue.cmcontinue)
[[ $cmcontinue == null ]] && break
more="&cmcontinue=$cmcontinue"
done

18
bin/rcd-langs-per-task Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -e -u -o pipefail
root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)
cd "$root"
total=0
for task in Task/*; do
count=$(find "$task" -type d | wc -l)
count=$((count-1))
printf '%06d %s\n' "$count" "${task#Task/}"
total=$((total+count))
done
printf '%06d %s\n' "$total" Total

19
bin/rcd-new-langs Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -e -u -o pipefail
root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)
cd "$root"
bin/rcd-api-list-all-langs |
while read -r lang; do
re=${lang//\\/\\\\}
re=${re//+/\\+}
re=${re//\*/\\*}
re=${re//\(/\\\(}
grep -Eq "^'?$re'?: '?\." Conf/lang.yaml ||
echo "$lang"
done |
grep -Ev '([éæ:]|Languages by Feature|Programming Language|Oberon-2|Free Pascal)' ||
true

18
bin/rcd-new-tasks Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -e -u -o pipefail
root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)
cd "$root"
bin/rcd-api-list-all-tasks |
while read -r lang; do
re=${lang//\\/\\\\}
re=${re//+/\\+}
re=${re//\*/\\*}
re=${re//\(/\\\(}
grep -Eq "^\"$re\":$" Conf/task.yaml ||
echo "$lang"
done |
grep -v '[^"$^]'

17
bin/rcd-samples-per-lang Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -e -u -o pipefail
root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)
cd "$root"
total=0
for lang in Lang/*; do
count=$(find -L "$lang" -type f -not -name '00-*' | wc -l)
printf '%06d %s\n' "$count" "${lang#Lang/}"
total=$((total+count))
done
printf '%06d %s\n' "$total" Total

17
bin/rcd-samples-per-task Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -e -u -o pipefail
root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)
cd "$root"
total=0
for task in Task/*; do
count=$(find "$task" -type f -not -name '00-*' | wc -l)
printf '%06d %s\n' "$count" "${task#Task/}"
total=$((total+count))
done
printf '%06d %s\n' "$total" Total

17
bin/rcd-tasks-per-lang Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -e -u -o pipefail
root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)
cd "$root"
total=0
for lang in Lang/*; do
count=$(find "$lang" -type l | wc -l)
printf '%06d %s\n' "$count" "${lang#Lang/}"
total=$((total+count))
done
printf '%06d %s\n' "$total" Total