Skip to content

Commit 324743a

Browse files
authored
add-exercise-script-changes: Added usage of the 'configlet create --practice-exercise'. (#136)
1 parent 18e29d5 commit 324743a

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

bin/add-exercise

+1-24
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,15 @@ if [ $# -ne 1 ]; then
77
exit 1
88
fi
99

10-
command -v jq >/dev/null 2>&1 || {
11-
echo >&2 "jq is required but not installed. Please install it and make sure it's in your PATH."
12-
exit 1
13-
}
14-
command -v curl >/dev/null 2>&1 || {
15-
echo >&2 "curl is required but not installed. Please install it and make sure it's in your PATH."
16-
exit 1
17-
}
18-
1910
bin/fetch-configlet
2011

2112
# Add entry for exercise in config.json
2213
slug="${1}"
23-
name=$(echo "${slug}" | sed 's/\b\w/\u&/g')
24-
uuid=$(bin/configlet uuid)
25-
jq --arg slug "${slug}" --arg uuid "${uuid}" --arg name "${name}" \
26-
'.exercises.practice += [{slug: $slug, name: $name, uuid: $uuid, practices: [], prerequisites: [], difficulty: 1}]' \
27-
config.json > config.json.tmp && mv config.json.tmp config.json
14+
bin/configlet create --practice-exercise "${slug}"
2815

29-
# Sync the exercise
30-
bin/configlet sync --update --yes --tests include --filepaths --metadata --docs --exercise "${slug}"
31-
32-
newline=$'\n'
3316
camel_name=$(sed -E 's/-([a-z])/\U\1/g' <<< "${slug}")
3417
exercise_dir="exercises/practice/${slug}"
3518

36-
touch "${exercise_dir}/${camel_name}.u"
37-
touch "${exercise_dir}/${camel_name}.test.u"
38-
39-
mkdir -p "${exercise_dir}/.meta/examples"
40-
touch "${exercise_dir}/.meta/examples/${camel_name}.example.u"
41-
4219
cat <<EOT > "${exercise_dir}/.meta/testLoader.md"
4320
# Testing transcript for ${slug} exercise
4421

0 commit comments

Comments
 (0)