|
18 | 18 |
|
19 | 19 | ### Testing |
20 | 20 |
|
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. |
25 | 34 |
|
26 | 35 | </div> |
27 | 36 |
|
@@ -60,6 +69,42 @@ version manager such as [`rbenv`](https://github.com/rbenv/rbenv) or |
60 | 69 | `:development` group so `jekyll serve` works on Ruby 3.0+ (GitHub Pages |
61 | 70 | production does not use `webrick`). |
62 | 71 |
|
| 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 | + |
63 | 108 | #### Viewing the site |
64 | 109 |
|
65 | 110 | You will see messages that confirm that site has generated and the server is |
|
0 commit comments