-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_readmes
executable file
·72 lines (51 loc) · 1.36 KB
/
update_readmes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
shopt -s nullglob
if [[ ! -d .exercism ]]; then
printf "ERROR: Run from inside a project directory.\n\n"
exit 1
fi
#declare package_name
declare project_dir
get_track_package_name() {
basename "${PWD}"
} # get_track_package_name()
#package_name="$(get_track_package_name)"
project_dir="$(basename "${PWD}")"
if ! grep -q ./"${project_dir}"/README.md ../README.md; then
cat >>../README.md <<EOF
- [${project_dir}](./${project_dir}/README.md)
EOF
fi
declare -a GLEAM_FILES
mapfile -t GLEAM_FILES < <(jq -r '.files.solution[]' .exercism/config.json)
if ! grep -q "My Solution" ./README.md; then
# Two empty spaces because the file is missing a trailing new line.
# shellcheck disable=SC2129
cat >>./README.md <<EOF
### My Solution
EOF
for f in "${GLEAM_FILES[@]}"; do
printf -- "- [%s](%s)\n" "${f##*/}" "./${f}"
done | tee -a ./README.md
cat >>./README.md <<EOF
- [run-tests](./run-tests-gleam.txt)
EOF
fi
# sed -r -i -e 's/xtest/test/g' ./*.spec.js
# git add ./*.spec.js
#
# if [[ ! -f .prettierignore ]]; then
# ln -sv ../.prettierignore .prettierignore
# git add .prettierignore
# printf "\n"
# fi
printf "\n"
git add ../README.md ./README.md
git diff --cached ../README.md ./README.md
printf "\n"
#sed -r -i -e 's/^(\s+)(skip)\b.*$/\1# \2/g' ./*_test.rb
#git add ./*_test.rb
#git diff --cached ./*_test.rb
#printf "\n"
git status ..
printf "\n"