forked from overhangio/cookiecutter-tutor-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: olive updates, more scaffolding, and basic 'make test'
* Confirm that cookiecutter generates a plugin that is compatible with the Tutor v15 (and Open edX Olive). Closes overhangio#12. * Replace COMMANDS_INIT (which is deprecated in v15/Olive) with equivalent usage of CLI_DO_INIT_TASKS (which is new in v15/Olive). Closes overhangio#15. * Add boilerplate & explanation for CLI_DO_COMMANDS (new in v15/Olive), include a dummy example `tutor local do say-hi` job. * Add boilerplate and explanation for CLI_COMMANDS, including a dummy example `tutor myplugin print-repo` command. * Un-comment as much of the image management block as possible in order to help avoid instances of syntactically invalid commented-out code such as: overhangio#16 * Add Makefile to both cookiecutter root as well as generated plugin, providing make rules `test`, `test-format`, `test-lint`, and `test-types`. They are not yet run in CI. Part of overhangio#7.
- Loading branch information
1 parent
7b6b9f3
commit 8ef7e17
Showing
8 changed files
with
194 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/tutor-contrib-myplugin |
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,28 @@ | ||
.PHONY: generate-plugin-for-tests help test test-plugin test-plugin-install \ | ||
test-plugin-quality | ||
.DEFAULT_GOAL := help | ||
|
||
# Warning: These checks are not yet run on every PR. | ||
# We will add them to CI as part of https://github.com/overhangio/cookiecutter-tutor-plugin/issues/7). | ||
test: generate-plugin-for-tests test-plugin ## Runs all checks for this repo. | ||
|
||
generate-plugin-for-tests: ## Generate a plugin using the cookiecutter defaults. | ||
rm -rf tutor-contrib-myplugin | ||
cookiecutter --no-input . | ||
|
||
test-plugin: test-plugin-quality test-plugin-install ## Test the default plugin. | ||
|
||
test-plugin-quality: ## Run static checks on the default plugin. | ||
cd tutor-contrib-myplugin && make test | ||
|
||
test-plugin-install: ## Smoke-test that the default plugin works with Tutor. | ||
pip install -e tutor-contrib-myplugin | ||
tutor plugins enable myplugin | ||
tutor config save | ||
tutor myplugin print-repo # This should just print a line and exit 0. | ||
|
||
ESCAPE = | ||
help: ## Print this help | ||
@grep -E '^([a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \ | ||
| sed 's/######* \(.*\)/@ $(ESCAPE)[1;31m\1$(ESCAPE)[0m/g' | tr '@' '\n' \ | ||
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[33m%-30s\033[0m %s\n", $$1, $$2}' |
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,28 @@ | ||
.DEFAULT_GOAL := help | ||
.PHONY: docs | ||
SRC_DIRS = ./{{ cookiecutter.module_name }} | ||
BLACK_OPTS = --exclude templates ${SRC_DIRS} | ||
|
||
# Warning: These checks are not necessarily run on every PR. | ||
test: test-lint test-types test-format # Run some static checks. | ||
|
||
test-format: ## Run code formatting tests | ||
black --check --diff $(BLACK_OPTS) | ||
|
||
test-lint: ## Run code linting tests | ||
pylint --errors-only --enable=unused-import,unused-argument --ignore=templates --ignore=docs/_ext ${SRC_DIRS} | ||
|
||
test-types: ## Run type checks. | ||
mypy --exclude=templates --ignore-missing-imports --implicit-reexport --strict ${SRC_DIRS} | ||
|
||
format: ## Format code automatically | ||
black $(BLACK_OPTS) | ||
|
||
isort: ## Sort imports. This target is not mandatory because the output may be incompatible with black formatting. Provided for convenience purposes. | ||
isort --skip=templates ${SRC_DIRS} | ||
|
||
ESCAPE = | ||
help: ## Print this help | ||
@grep -E '^([a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \ | ||
| sed 's/######* \(.*\)/@ $(ESCAPE)[1;31m\1$(ESCAPE)[0m/g' | tr '@' '\n' \ | ||
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[33m%-30s\033[0m %s\n", $$1, $$2}' |
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
1 change: 1 addition & 0 deletions
1
.../{{ cookiecutter.module_name }}/templates/{{ cookiecutter.plugin_name }}/jobs/init/cms.sh
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 @@ | ||
# Add your CMS initialization commands here. |
1 change: 1 addition & 0 deletions
1
.../{{ cookiecutter.module_name }}/templates/{{ cookiecutter.plugin_name }}/jobs/init/lms.sh
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 @@ | ||
# Add your LMS initialization commands here. |
1 change: 1 addition & 0 deletions
1
...{ cookiecutter.module_name }}/templates/{{ cookiecutter.plugin_name }}/jobs/init/mysql.sh
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 @@ | ||
# Add your MySQL initialization commands here. |
Empty file.