mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-12-04 19:03:39 +00:00
feat: importdemocourse --repo-dir=...
option
This allows us to run: tutor local do importdemocourse --repo=https://github.com/openedx/openedx-test-course --version=open-release/palm.master --repo-dir=test-course/course
This commit is contained in:
parent
b3c3c4a2cc
commit
6dbb5baf81
2
changelog.d/20230502_090803_regis_palm.md
Normal file
2
changelog.d/20230502_090803_regis_palm.md
Normal file
@ -0,0 +1,2 @@
|
||||
- [Feature] Add the `do importdemocourse --repo-dir=...` option, to import courses from subdirectories of git repositories. This allows us to import the openedx-test-course in Palm with: `tutor local do importdemocourse --repo=https://github.com/openedx/openedx-test-course --version=o
|
||||
pen-release/palm.master --repo-dir=test-course/course`. (by @regisb)
|
@ -146,19 +146,26 @@ u.save()"
|
||||
show_default=True,
|
||||
help="Git repository that contains the course to be imported",
|
||||
)
|
||||
@click.option(
|
||||
"-d",
|
||||
"--repo-dir",
|
||||
default="",
|
||||
show_default=True,
|
||||
help="Git relative subdirectory to import data from",
|
||||
)
|
||||
@click.option(
|
||||
"-v",
|
||||
"--version",
|
||||
help="Git branch, tag or sha1 identifier. If unspecified, will default to the value of the OPENEDX_COMMON_VERSION setting.",
|
||||
)
|
||||
def importdemocourse(
|
||||
repo: str, version: t.Optional[str]
|
||||
repo: str, repo_dir: str, version: t.Optional[str]
|
||||
) -> t.Iterable[tuple[str, str]]:
|
||||
version = version or "{{ OPENEDX_COMMON_VERSION }}"
|
||||
template = f"""
|
||||
# Import demo course
|
||||
git clone {repo} --branch {version} --depth 1 /tmp/course
|
||||
python ./manage.py cms import ../data /tmp/course
|
||||
python ./manage.py cms import ../data /tmp/course/{repo_dir}
|
||||
|
||||
# Re-index courses
|
||||
./manage.py cms reindex_course --all --setup"""
|
||||
|
Loading…
Reference in New Issue
Block a user