-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: adds a test to ensure we don't break our folder structure for …
…document snippets
- Loading branch information
1 parent
ccb3208
commit 75147dd
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
# This script ensures that each of our languages `docs` directories has a `current` directory to ensure snippets populate on our website | ||
|
||
LINT_FAILED=0 | ||
FAILED_LANG="" | ||
|
||
main() { | ||
# Iterate over each directory and run tests | ||
for LANG_FULL_PATH in official/docs/*; do | ||
if [ -d "$LANG_FULL_PATH" ]; then | ||
if [ "$LANG_FULL_PATH" == "official/docs/responses" ]; then | ||
# The responses dir won't have a `current` set since these aren't versioned | ||
continue | ||
elif [ ! -d "$LANG_FULL_PATH"/current ]; then | ||
FAILED_LANG+="$LANG_FULL_PATH\n" | ||
LINT_FAILED=1 | ||
fi | ||
fi | ||
done | ||
|
||
# Set exit code based on if the tests passed or failed | ||
if [ "$LINT_FAILED" == 0 ]; then | ||
printf "Check for 'current' directories in docs passed!\n" | ||
exit 0 | ||
else | ||
printf "The following language directories do not have a 'current' directory:\n" | ||
printf "%b" "$FAILED_LANG" | ||
exit 1 | ||
fi | ||
} | ||
|
||
main |