-
-
Notifications
You must be signed in to change notification settings - Fork 703
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DATASETTE_LOAD_PLUGINS environment variable for loading specific plugins
Closes #2164 * Load only specified plugins for DATASETTE_LOAD_PLUGINS=datasette-one,datasette-two * Load no plugins if DATASETTE_LOAD_PLUGINS='' * Automated tests in a Bash script for DATASETTE_LOAD_PLUGINS
- Loading branch information
Showing
4 changed files
with
109 additions
and
1 deletion.
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
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,29 @@ | ||
#!/bin/bash | ||
# This should only run in environemnts where both | ||
# datasette-init and datasette-json-html are installed | ||
|
||
PLUGINS=$(datasette plugins) | ||
echo "$PLUGINS" | jq 'any(.[]; .name == "datasette-json-html")' | \ | ||
grep -q true || ( \ | ||
echo "Test failed: datasette-json-html not found" && \ | ||
exit 1 \ | ||
) | ||
# With the DATASETTE_LOAD_PLUGINS we should not see that | ||
PLUGINS2=$(DATASETTE_LOAD_PLUGINS=datasette-init datasette plugins) | ||
echo "$PLUGINS2" | jq 'any(.[]; .name == "datasette-json-html")' | \ | ||
grep -q false || ( \ | ||
echo "Test failed: datasette-json-html should not have been loaded" && \ | ||
exit 1 \ | ||
) | ||
echo "$PLUGINS2" | jq 'any(.[]; .name == "datasette-init")' | \ | ||
grep -q true || ( \ | ||
echo "Test failed: datasette-init should have been loaded" && \ | ||
exit 1 \ | ||
) | ||
# With DATASETTE_LOAD_PLUGINS='' we should see no plugins | ||
PLUGINS3=$(DATASETTE_LOAD_PLUGINS='' datasette plugins) | ||
echo "$PLUGINS3"| \ | ||
grep -q '\[\]' || ( \ | ||
echo "Test failed: datasette plugins should have returned []" && \ | ||
exit 1 \ | ||
) |