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'
* Replace COMMANDS_INIT (which is deprecated in Olive) with equivalent usage of CLI_DO_INIT_TASKS (which is new in Olive). Closes overhangio#15. * Add boilerplate & explanation for CLI_DO_COMMANDS (new in 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. * 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
72ee1e5
commit c1fd177
Showing
8 changed files
with
148 additions
and
5 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,26 @@ | ||
.PHONY: generate-plugin-for-tests help test test-plugin test-plugin-install \ | ||
test-plugin-quality | ||
.DEFAULT_GOAL := help | ||
|
||
test: generate-plugin-for-tests test-plugin | ||
|
||
generate-plugin-for-tests: | ||
rm -rf tutor-contrib-myplugin | ||
cookiecutter --no-input . | ||
|
||
test-plugin: test-plugin-quality test-plugin-install | ||
|
||
test-plugin-quality: | ||
cd tutor-contrib-myplugin && make test | ||
|
||
test-plugin-install: | ||
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,27 @@ | ||
.DEFAULT_GOAL := help | ||
.PHONY: docs | ||
SRC_DIRS = ./{{ cookiecutter.module_name }} | ||
BLACK_OPTS = --exclude templates ${SRC_DIRS} | ||
|
||
test: test-lint test-types test-format # Runs checks, all of which are static. These no CI check for any of these (yet... to be fixed in https://github.com/overhangio/cookiecutter-tutor-plugin/issues/7). | ||
|
||
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.