|
| 1 | +## A note to course authors & contributors |
| 2 | + |
| 3 | +As a course author or maintainer, you will need to have `cmta`, the CMT |
| 4 | +administrator CLI, installed on your system. |
| 5 | + |
| 6 | +`cmta` can be installed via Coursier as follows: |
| 7 | + |
| 8 | +```bash |
| 9 | +$ cs install --contrib cmta |
| 10 | +Wrote cmta |
| 11 | +``` |
| 12 | + |
| 13 | +Using the `cmta` command, two artefacts can be generated from this repo: |
| 14 | + |
| 15 | +- a so-called `studentified` repo. This artefact is distributed to course students. |
| 16 | +- a `linearized` repo. This is git repository in which every exercise in the |
| 17 | +master repository is turned into a commit. It can be used to: |
| 18 | + - edit the master repository: In general this is a scratch pad repository that |
| 19 | + is discarded once it has served its purpose. In this use case, interactive rebasing |
| 20 | + on the linearized repo is used to transform the code across a range of exercises. |
| 21 | + Once this rebasing is finished, all applied changes can be applied on the master |
| 22 | + repo by a process of `delinearization` |
| 23 | + - to inspect the differences between consecutive exercises (using a tools such as `SourceTree`) |
| 24 | + |
| 25 | +### How to _"studentify"_ a master repository |
| 26 | + |
| 27 | +#### Clone the main repo |
| 28 | + |
| 29 | +Clone this repo (aka the main repo for this course) to your computer: |
| 30 | + |
| 31 | +```bash |
| 32 | +$ mkdir ~/Courses |
| 33 | + |
| 34 | +$ cd ~/Courses |
| 35 | + |
| 36 | +$ git clone [email protected]:lunatech-labs/lunatech-scala2-to-scala3-course.git |
| 37 | + |
| 38 | +$ ls -l |
| 39 | +drwxr-xr-x@ 17 ericloots staff 544 11 Mar 08:55 lunatech-scala2-to-scala3-course |
| 40 | + |
| 41 | +``` |
| 42 | + |
| 43 | +#### Create a folder that will hold the studentified repo |
| 44 | + |
| 45 | +Create a folder in which the _studentified_ version will be created. For example: |
| 46 | + |
| 47 | +```bash |
| 48 | +$ mkdir ~/tmp/stu |
| 49 | +``` |
| 50 | + |
| 51 | +#### Generate the studentified repo using `cmta` |
| 52 | + |
| 53 | +Run the `cmta` command to _studentify_ the main repo: |
| 54 | + |
| 55 | +```bash |
| 56 | +$ cmta studentify -f -m . -d ~/tmp/stu |
| 57 | +Studentifying lunatech-scala2-to-scala3-course to /Users/ericloots/tmp/stu/lunatech-scala2-to-scala3-course |
| 58 | +............... |
| 59 | +Processed exercises: |
| 60 | + exercise_000_sudoku_solver_initial_state |
| 61 | + exercise_001_dotty_deprecated_syntax_rewriting |
| 62 | + exercise_002_dotty_new_syntax_and_indentation_based_syntax |
| 63 | + exercise_003_top_level_definitions |
| 64 | + exercise_004_parameter_untupling |
| 65 | + exercise_005_extension_methods |
| 66 | + exercise_006_using_and_summon |
| 67 | + exercise_007_givens |
| 68 | + exercise_008_enum_and_export |
| 69 | + exercise_009_union_types |
| 70 | + exercise_010_exploring_opaque_type_aliases |
| 71 | + exercise_011_optional_opaque_type_aliases |
| 72 | + exercise_012_multiversal_equality |
| 73 | + exercise_020_opaque_type_aliases_alt |
| 74 | + exercise_021_multiversal_equality |
| 75 | + |
| 76 | +$ cd ~/tmp/stu/lunatech-scala2-to-scala3-course |
| 77 | + |
| 78 | +$ ls -l ~/tmp/stu/lunatech-scala2-to-scala3-course/ |
| 79 | +total 32 |
| 80 | +-rw-r--r--@ 1 ericloots staff 1305 21 Aug 16:54 IDE_setup.md |
| 81 | +-rw-r--r--@ 1 ericloots staff 7254 21 Aug 16:54 README.md |
| 82 | +-rw-r--r--@ 1 ericloots staff 429 21 Aug 16:54 build.sbt |
| 83 | +drwxr-xr-x@ 3 ericloots staff 96 21 Aug 16:54 images |
| 84 | +drwxr-xr-x@ 5 ericloots staff 160 21 Aug 16:54 project |
| 85 | +drwxr-xr-x@ 4 ericloots staff 128 21 Aug 16:54 src |
| 86 | +drwxr-xr-x@ 3 ericloots staff 96 21 Aug 16:54 sudokus |
| 87 | +``` |
| 88 | + |
| 89 | +### How to _"linearize"_ a master repository |
| 90 | + |
| 91 | +From a main CMT repository, a so-called "linearized" repository can created. The |
| 92 | +latter is a git repo, where each commit corresponds to the exercise code in |
| 93 | +the main CMT repository. |
| 94 | + |
| 95 | +A linearized repo can be used for at least to purposes: |
| 96 | + |
| 97 | +1. Exercises can be modified using interactive rebasing. The modifications can |
| 98 | + then be reflected back in the main CMT repository by "delinearization", the |
| 99 | + inverse process of "linearization". |
| 100 | +2. Inspect code changes between consecutive exercises. |
| 101 | + |
| 102 | +#### Generate the linearized repo using `cmta` |
| 103 | + |
| 104 | +Run the `cmta` command to _linearized_ the main repo: |
| 105 | + |
| 106 | +```bash |
| 107 | +$ cmta linearize -f -m ~/Lunatech/Courses/cmt2.0/lunatech-scala2-to-scala3-course -d ~/tmp/lin |
| 108 | +Linearizing lunatech-scala2-to-scala3-course to /Users/ericloots/tmp/lin/lunatech-scala2-to-scala3-course |
| 109 | +............... |
| 110 | +Successfully linearized /Users/ericloots/Lunatech/Courses/cmt2.0/lunatech-scala2-to-scala3-course |
| 111 | +``` |
| 112 | + |
| 113 | +Now we can have a look at the linearized repository: |
| 114 | + |
| 115 | +```bash |
| 116 | +$ cd /Users/ericloots/tmp/lin/lunatech-scala2-to-scala3-course |
| 117 | + |
| 118 | +$ git log --oneline |
| 119 | +71f5989 (HEAD -> main) exercise_021_multiversal_equality |
| 120 | +896e6b9 exercise_020_opaque_type_aliases_alt |
| 121 | +105be7d exercise_012_multiversal_equality |
| 122 | +9e8c117 exercise_011_optional_opaque_type_aliases |
| 123 | +5edbcb9 exercise_010_exploring_opaque_type_aliases |
| 124 | +913bc7d exercise_009_union_types |
| 125 | +45f22bd exercise_008_enum_and_export |
| 126 | +2603fc4 exercise_007_givens |
| 127 | +cd8306a exercise_006_using_and_summon |
| 128 | +d1c6a66 exercise_005_extension_methods |
| 129 | +30d471e exercise_004_parameter_untupling |
| 130 | +47ca6f2 exercise_003_top_level_definitions |
| 131 | +2c8b691 exercise_002_dotty_new_syntax_and_indentation_based_syntax |
| 132 | +499cbd8 exercise_001_dotty_deprecated_syntax_rewriting |
| 133 | +e0ff2b4 exercise_000_sudoku_solver_initial_state |
| 134 | +``` |
0 commit comments