Skip to content

Commit 2f62ad1

Browse files
Fix jq variable substitution (#11)
* fix jq * try jq again * try new approach * cleanup * SC2002 (style): Useless cat. * remove projects json, add info to _project_.json in project dir
1 parent 127413c commit 2f62ad1

File tree

3 files changed

+8
-57
lines changed

3 files changed

+8
-57
lines changed

src/commands/copy_docs_to_target.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,5 @@ steps:
1212
command: <<include(scripts/move_static_content.sh)>>
1313
- run:
1414
name: "Create _category_.json"
15-
command: <<include(scripts/create_category_json.sh)>>
16-
- run:
17-
name: "Update projects.json"
18-
command: <<include(scripts/update_projects_json.sh)>>
15+
command: <<include(scripts/create_project_json.sh)>>
16+

src/scripts/create_category_json.sh renamed to src/scripts/create_project_json.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@
22

33
# Assumes LABEL, DESCRIPTION, TARGET_REPO_DIRECTORY, and PROJECT_NAME are environment variables
44

5-
CreateCategoryJSONFromTemplate() {
5+
CreateProjectJSONFromTemplate() {
66
# Inlined template with placeholders
77
# shellcheck disable=SC2016
8-
TEMPLATE='{"label": "${LABEL}","link": {"type": "generated-index","description": "${DESCRIPTION}"}}'
8+
TEMPLATE='{"label": "${LABEL}","description": "${DESCRIPTION}", projectName:"${PROJECT_NAME}"}'
99

1010
# Substitute the variables in the template and write to target location
1111
echo "$TEMPLATE" | sed \
1212
-e "s/\${LABEL}/$LABEL/" \
1313
-e "s/\${DESCRIPTION}/$DESCRIPTION/" \
14-
> "$TARGET_REPO_DIRECTORY/docs/$PROJECT_NAME/_category_.json"
14+
-e "s/\${PROJECT_NAME}/$PROJECT_NAME/" \
15+
> "$TARGET_REPO_DIRECTORY/docs/$PROJECT_NAME/_project_.json"
1516

16-
echo "_category_.json file created successfully."
17+
echo "_project_.json file created successfully."
1718
}
1819

1920
# Check for bats
2021
ORB_TEST_ENV="bats-core"
2122
if [ "${0#*"$ORB_TEST_ENV"}" = "$0" ]; then
22-
CreateCategoryJSONFromTemplate
23+
CreateProjectJSONFromTemplate
2324
fi

src/scripts/update_projects_json.sh

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)