Lesson 2.2: Getting the code for a class
There are three ways to put Exponential on a machine, and they suit different courses. A developer course wants Git clones with their history; an editor course only needs a working site. This lesson shows each way and how to make sure every learner has exactly the same version, which is what keeps exercises reproducible.
At a glance
| Course | Train the trainer |
| Module | Module 2: Building the training lab |
| Duration | 40 minutes (10 presenting, 30 exercise) |
| Level | Intermediate |
| Audience | Trainers who prepare labs |
| Prerequisites | Lesson 2.1; Git and Composer on the machine |
Learning objectives
After this lesson, learners can:
- choose between
git clonewithcomposer installandcomposer create-projectfor a given course; - install a chosen release instead of the development line;
- list the newest release tags in the right order;
- check that the extensions arrived as Git clones when they should.
Trainer's notes
How to present it
- Show the three ways from Getting the code, 3.2
(5 minutes): A.
git cloneandcomposer install(recommended for building websites), B.composer create-project(a site you only run, a quick evaluation), C.composer requireinto an empty directory. - Recommend per course (3 minutes): Developers, Theme design and Layouts development: way A. Editors, Site administration, Hosting: way B with a fixed release.
- Show how to pin a release (2 minutes):
composer create-project se7enxweb/exponential:v6.0.14 exponential, or for a clonegit switch -c my-site v6.0.14beforecomposer install.
Common questions
main or a release? For a course, a release: every learner sees the same thing, and your rehearsal matches. Use
main only for a course about contributing.
Why is git status full of untracked extensions? The extensions are separate Git repositories cloned into
extension/<name> by Composer; they are not part of the kernel's repository. That is expected.
How do I see the newest release? git tag -l 'v6.*' --sort=version:refname | tail -3. Always sort by version:
by name, v6.0.10 comes before v6.0.8.
Pitfalls
- A slow network. The full clone has the whole history (more than 27,000 commits). For a class on a slow network, prepare the code in advance on each machine or on a shared drive.
- Mixed versions. One learner on
main, the rest on a release: exercises differ. Check withgit describe --tags. - Running as root. Files created by
rootcannot be changed by the web server later. Install as a normal user.
Hands-on exercise
Prepare the code for a developer course (way A) and for an editor course (way B) on one machine.
- For way A, once per user account:
composer config --global 'preferred-install.se7enxweb/*' source. git clone https://github.com/se7enxweb/exponential.git dev-course, thencd dev-course.- List the newest releases:
git fetch origin --tagsandgit tag -l 'v6.*' --sort=version:refname | tail -3. Choose the newest one. git switch -c training <the tag>and thencomposer install.- Check:
ls -d extension/*/.git | wc -lprints the number of extensions installed as clones;git describe --tagsnames the release. - For way B, in another directory:
composer create-project se7enxweb/exponential:<the tag> editor-course. - Write the two exact command sequences on your trainer sheet, with the tag you used.
Expected result
dev-courseis a clone on the branchtrainingmade from the chosen release, with extensions as Git clones.editor-courseholds the same release, installed from archives.- The trainer sheet has the two command sequences with one fixed tag.
Quiz
- Which way of getting the code is recommended for developer courses?
- Why should every learner in a course use the same release?
- Why is
git tag -l 'v6.*' | tail -1a wrong way to find the newest release? - After
composer installin a clone,git statuslists many untrackedextension/directories. Is that a problem?
Answers
git clonewithcomposer install(way A).- So that every exercise gives the same result as the trainer's rehearsal.
- It sorts by name, so
v6.0.10comes beforev6.0.8; use--sort=version:refname(Update with Git). - No. The extensions are separate repositories and are not part of the kernel's repository.
Further reading
- Getting the code: all three ways in detail.
- Develop with Git: working with the clones.
- Update with Git: keeping a lab up to date between courses.
Related pages
- Module 2: Building the training lab
- Train the trainer: course overview
- Trainers: start here
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.