Skip to content

Commit 2ea6e87

Browse files
andy5995claude
andauthored
Document testing the site generation script in the README (#148)
Adds context to the Testing section explaining that the catalog pages are auto-generated by ivan-hc/AM:tools/am2pla-site and overwritten every 30 minutes by the sync workflow, with the list of which files in this repo are durable vs regenerated. Adds Option 3 with a worktree-based recipe for testing changes to am2pla-site itself: detached worktree, patched script (sed neutralises the cd-to-Desktop), run inside the worktree, preview via the Option 1 Docker command. Includes the gotcha about root-owned files left by the Docker container and how to clean them up. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 864cc1f commit 2ea6e87

1 file changed

Lines changed: 49 additions & 4 deletions

File tree

README.md

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,19 @@
1818

1919
### Testing
2020

21-
To test changes to the website before pushing or while working on a pull
22-
request, pick one of the two options below. Docker is recommended because
23-
the container matches the GitHub Pages build environment and works on any
24-
host Ruby version.
21+
Most pages on this site are auto-generated by `tools/am2pla-site` in
22+
the [`ivan-hc/AM`](https://github.com/ivan-hc/AM) repository — a
23+
GitHub Actions workflow runs that script every 30 minutes and pushes
24+
the output back to `main`. Hand-edits to generated files (`index.md`,
25+
`apps.md`, `appimages.md`, the 24 category pages, `apps.json`, the
26+
`am2pla-site` copy in this repo) are overwritten on the next sync.
27+
Durable changes live in `_layouts/`, `assets/css/`, `assets/js/`,
28+
`_config.yml`, `Gemfile`, this README, and `.github/workflows/`.
29+
30+
To test changes to the website before pushing or while working on a
31+
pull request, pick one of the three options below. Docker is
32+
recommended because the container matches the GitHub Pages build
33+
environment and works on any host Ruby version.
2534

2635
</div>
2736

@@ -60,6 +69,42 @@ version manager such as [`rbenv`](https://github.com/rbenv/rbenv) or
6069
`:development` group so `jekyll serve` works on Ruby 3.0+ (GitHub Pages
6170
production does not use `webrick`).
6271

72+
#### Option 3: Testing changes to the site generation script
73+
74+
If you are changing `tools/am2pla-site` in the `ivan-hc/AM` repository
75+
(the script that produces the catalog pages on every sync), run it
76+
against a detached worktree of this site so the output doesn't pollute
77+
your main checkout. The `sed` mirrors what the sync workflow does — it
78+
neutralises the script's `cd "$(xdg-user-dir DESKTOP)"` so output lands
79+
in the worktree instead of your Desktop directory.
80+
81+
```sh
82+
# Adjust to wherever you have ivan-hc/AM cloned
83+
AM_REPO=~/src/AM
84+
85+
# Detached worktree of this repo's main branch
86+
git worktree add -d ../pla-site-test main
87+
88+
# Run the patched script inside the worktree
89+
sed 's|^cd "$(xdg-user-dir|#&|' "$AM_REPO/tools/am2pla-site" > /tmp/am2pla-site-test
90+
cd ../pla-site-test && bash /tmp/am2pla-site-test
91+
92+
# Preview with the Docker command from Option 1 (or use Option 2)
93+
docker run --rm -it -p 4000:4000 \
94+
-v "$PWD:/srv/jekyll" -w /srv/jekyll \
95+
-v jekyll-bundle:/usr/local/bundle \
96+
ruby:3.3 \
97+
bash -c "bundle install && bundle exec jekyll serve --host 0.0.0.0"
98+
99+
# Clean up when done
100+
cd - && git worktree remove --force ../pla-site-test
101+
```
102+
103+
When the Docker container runs as root it leaves a root-owned
104+
`_site/` and `Gemfile.lock` inside the worktree; `git worktree remove
105+
--force` will fail to delete those, so finish with
106+
`sudo rm -rf ../pla-site-test` if the remove complains.
107+
63108
#### Viewing the site
64109

65110
You will see messages that confirm that site has generated and the server is

0 commit comments

Comments
 (0)