Overview
Currently, when executing any of the cmtc
commands it's necessary to pass a "studentified repo" path which points to where the command will be executed.
This requires, of course, for the studentified version of a course to be present on the machine where the command is being executed.
What if the studentified version of the course could be downloaded automatically by the course management tools?
What if, once it has been downloaded, the course could be set as the default target for the cmtc
commands?
Implementation
What is proposed, then, is for the addition of 'package management' operations for the course management tools:
Install
The install
command would allow a user to specify the course to be downloaded and have the course management tools automatically get the course from wherever it is hosted and place it on the local machine.
This leads to two questions:
- Where are the courses stored remotely?
- Where is the downloaded course stored locally?
In an initial implementation i propose to have courses stored in Github repositories and use git clone
to download the files (allowing for them to be easily kept up-to-date).
So, the install command could just provide the username/project
convention, for example:
cmtc install thinkmorestupidless/studentified-test
Would clone the thinkmorestupidless/studentified-test
repository into some local location... where?
Following the conventions of other tools it would make sense to have the notion of a CMT_HOME
directory which defaults to ~/.cmt
In ~/.cmt
would be located a *.conf
file which can store any global configuration necessary for the tool operations (which can be loaded when the tool is executed) and a ~/.cmt/courses
sub-directory could store the courses themselves...
Giving this layout:
![Screenshot 2022-03-16 at 08 39 46](https://user-images.githubusercontent.com/30719883/158540206-ee745fa9-9ee5-4176-80bc-ba2a0ab2be80.png)
Context
Once a course has been installed we need to be able to tell the course management tools which course in the ~/.cmt/courses
directory we want to have the course management tools operate on (that is, which course to talk to when we issue next-exercise
, pull-solution
, etc)
By have *-context
commands we can have the course management tools write to a the ~/.cmt/cmt.conf
file and read from that file to set a current-context
property which points to the location of the course we want to operate on.
set-context
So, for example:
cmtc set-context studentified-test
would result in ~/.cmt/cmt.conf
looking like:
cmt {
current-context: "~/.cmt/courses/thinkmorestupidless/studentified-test"
}
We can then load ~/.cmt/cmt.conf
when the cmtc
is executed and have the context available as a default (which could also be overloaded if a path is supplied by any of the cmtc
commands.
# executes on the course specified in `cmt.current-context`
cmtc next-exercise
# executes on the course located at /my-course
cmtc next-exercise /my-course
get-context
To know the current context (which course i'm currently using) we can then add cmtc get-context
which will just print the value of cmt.current-context
to the screen
cmtc get-context
>> /Users/trevorburtonmccreadie/.cmt/courses/thinkmorestupidless/studentified-test