You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* initial refactor of create-template-assignment script
* handling various git and github states
* update cmdline args for mode
* removed debugging line
* update message for missing config
* debugging template update script
* updating tests for new scripts
help="Name of assignment. Must match name in nbgrader release directory",
431
431
)
432
432
parser.add_argument(
433
433
"--custom-message",
434
434
action="store_true",
435
-
help="Use a custom commit message for git. Will open the default git text editor for entry. If not set, will use message 'Initial commit'.",
435
+
help="Use a custom commit message for git. Will open the default git text editor for entry (if not set, uses default message 'Initial commit').",
436
436
)
437
437
parser.add_argument(
438
-
"--local-only",
438
+
"--github",
439
439
action="store_true",
440
-
help="Create local template repository only; do not create GitHub repo or push to GitHub (default: False)",
440
+
help="Also perform the GitHub operations (create remote repo on GitHub and push to remote (by default, only does local repository setup)",
441
441
)
442
442
parser.add_argument(
443
443
"--mode",
444
444
choices=["delete", "fail", "merge"],
445
445
default="fail",
446
-
help="Action if template directory already exists. Choices are: delete = delete the directory and contents; fail = exit and let user delete or rename; merge = keep existing dir, overwrite existing files, add new files. Default is fail.",
# these are the steps to create the local git repository
456
-
assignment=args.assignment
457
-
template_repo_path=template.create_template_dir(
458
-
config, assignment, args.mode
450
+
template.new_update_template(args)
451
+
452
+
453
+
defupdate_template():
454
+
"""
455
+
Updates an existing assignment template repository: update / add new and changed files, then push local changes to GitHub. Will open git editor to ask for
Copy file name to clipboardExpand all lines: abcclassroom/template.py
+78-12Lines changed: 78 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -6,22 +6,76 @@
6
6
importos
7
7
importsys
8
8
importshutil
9
+
frompathlibimportPath
9
10
10
11
from . importconfigascf
11
12
from . importgithub
12
13
from . importutils
13
14
14
15
16
+
defnew_update_template(args):
17
+
"""
18
+
Creates or updates an assignment template repository. Implementation of both the new_template and update_template console scripts (which perform the same basic functions but with different command line arguments and defaults).
Creates a new directory in template_dir that will become the
18
-
template repository for the assignment.
72
+
template repository for the assignment. If directory exists and mode is merge, do nothing. If directory exists and mode is delete, remove contents but leave .git directory.
0 commit comments