Upgrade to the unreleased version of YOCaml 2 #2

Merged
reynir merged 4 commits from yocaml2 into main 2024-10-04 11:24:35 +00:00
Owner

/cc @hannes /cc @reynir This is the upgrade to yocaml 2. The main diff is the multi-stage generation. All the blog engine is described into bin/blog.ml{,i}. Then, two tools are available, bin/watch.exe to see the result & bin/push.exe which pushes the commit into our repository (gh-pages). The program needs OCaml 5 due to httpcats to serve. A PR about that is pending and I hope they will release soon YOCaml 2.

/cc @hannes /cc @reynir This is the upgrade to yocaml 2. The main diff is the multi-stage generation. All the blog engine is described into `bin/blog.ml{,i}`. Then, two tools are available, `bin/watch.exe` to see the result & `bin/push.exe` which pushes the commit into our repository (gh-pages). The program needs OCaml 5 due to `httpcats` to serve. A PR about that is pending and I hope they will release soon YOCaml 2.
dinosaure added 1 commit 2024-09-30 18:42:46 +00:00
Owner

I think this is fine, I haven't looked into the details. There's only one thing I stumbled upon: now we pass --host=https://blog.robur.coop around, which as far as I can see is used for the links to the stylesheet and atom/rss feed -- previously they were links without host (/css/hl.css), now they are absolute ones with hostnames (https://blog.robur.coop/css/hl.css) -- I wonder why such a change is needed.

I think this is fine, I haven't looked into the details. There's only one thing I stumbled upon: now we pass `--host=https://blog.robur.coop` around, which as far as I can see is used for the links to the stylesheet and atom/rss feed -- previously they were links without host (`/css/hl.css`), now they are absolute ones with hostnames (`https://blog.robur.coop/css/hl.css`) -- I wonder why such a change is needed.
Author
Owner

I wonder why such a change is needed.

It was mostly due to my organisation. My blog is actually deployed into https://dinosaure.github.io/blogger & https://blog.osau.re/. So I need to change the host for both. I can delete it in this PR for blog.robur.coop as well 👍

> I wonder why such a change is needed. It was mostly due to my organisation. My blog is actually deployed into https://dinosaure.github.io/blogger & https://blog.osau.re/. So I need to change the host for both. I can delete it in this PR for blog.robur.coop as well 👍
Owner

I'm as well fine to have the host included tbh, and it seems like it'll be less work when updating yocaml again ;)

I'm as well fine to have the host included tbh, and it seems like it'll be less work when updating yocaml again ;)
reynir approved these changes 2024-10-01 09:30:25 +00:00
reynir left a comment
Owner

This change is big and hard to understand (there's no useful CHANGES for yocaml 2), but please feel free to merge if it works :)

This change is big and hard to understand (there's no useful CHANGES for yocaml 2), but please feel free to merge if it works :)
@ -24,4 +24,4 @@
- `tags`
You can specify an `author` (with its `name`, `email` and `link`) or not. By
default, we use `team@robur.coop`. If everything looks good, you can generate
Owner

I think by default we first look up author information in git config? I remember looking into this at some point. I think team@robur.coop is only used if neither author is passed nor is it configured in git config.

I think by default we first look up author information in git config? I remember looking into this at some point. I think team@robur.coop is only used if neither author is passed nor is it configured in git config.
Owner

Ah this might not be the case anymore. I can't tell.

Ah this might not be the case anymore. I can't tell.
Owner

Interesting, I always thought we need to specify the author.. and would be fine if we have to ;)

Interesting, I always thought we need to specify the author.. and would be fine if we have to ;)
@ -19,7 +19,6 @@ coauthors:
name: Reynir Björnsson
email: reynir@reynir.dk
link: https://reyn.ir/
contribution: What is this field used for?
Owner

:D

:D
@ -5,3 +5,3 @@
<ul class="tags-list">
{%- for tag in tags -%}
<li><a href="/tags/{{ tag }}.html">{{ tag }}</a></li>
<li>{{ tag }}</li>
Owner

Are these still links? It's not clear to me how they are links now.

Are these still links? It's not clear to me how they are links now.
Author
Owner

It's a step backwards since our first version. We need to develop a way of regenerating tags according to articles with YOCaml 2 (and thus reproduce the same links). This is feasible but requires a lot of work.

It's a step backwards since our first version. We need to develop a way of regenerating tags according to articles with YOCaml 2 (and thus reproduce the same links). This is feasible but requires a lot of work.
Owner

Ok, that's fine by me. Should we (temporarily) remove the tags then? Or wdyt?

Ok, that's fine by me. Should we (temporarily) remove the tags then? Or wdyt?
Author
Owner

I like the idea to keep them (and keep this date into our markdown files). We can think later about a process to generate tag HTML files.

I like the idea to keep them (and keep this date into our markdown files). We can think later about a process to generate tag HTML files.
Owner

Sorry I meant to temporarily remove the tags from the output. I definitely think we should keep the tags as meta data. I'm just not sure it's useful to see on the page a list of tags you can't click.

Sorry I meant to temporarily remove the tags *from the output*. I definitely think we should keep the tags as meta data. I'm just not sure it's useful to see on the page a list of tags you can't click.
Author
Owner

As you wish, I don't have too many opinions on the subject.

As you wish, I don't have too many opinions on the subject.
reynir reviewed 2024-10-04 10:41:49 +00:00
@ -0,0 +1,23 @@
(executable
(name watch)
Owner

This requires a version of dune more recent than at least 3.14.2 as otherwise it requires a (modules watch) stanza. Should we update dune-project and blogger.opam with dune 3.16.0?

This requires a version of dune more recent than at least 3.14.2 as otherwise it requires a `(modules watch)` stanza. Should we update dune-project and blogger.opam with dune 3.16.0?
Author
Owner

Yes, for sure!

Yes, for sure!
reynir marked this conversation as resolved
reynir added 2 commits 2024-10-04 11:15:53 +00:00
We depend on a feature newer than 3.14.2 and it works for 3.16.
reynir added 1 commit 2024-10-04 11:21:01 +00:00
Owner

I tested this on a fork, and to my surprise the remote needs a #branch otherwise it pushes to main (undesirable). So I changed the help text to be more explicit about that. Below is a commit with this, and the only change is new feeds (atom and rss1).

534480737c

I think we should merge this then.

Things that would be nice to have (later):

  1. Have the commit message include from what it was built, see

    Lines 134 to 149 in aa6bcc5
    let run_git_rev_parse default =
    let open Bos in
    let value = OS.Cmd.run_out
    Cmd.(v "git" % "describe" % "--always" % "--dirty"
    % "--exclude=*" % "--abbrev=0")
    in
    match OS.Cmd.out_string value with
    | Ok (value, (_, `Exited 0)) -> value
    | Ok (value, (run_info, _)) ->
    Logs.warn (fun m -> m "Failed to get commit id: %a: %s"
    Cmd.pp (OS.Cmd.run_info_cmd run_info)
    value);
    default
    | Error `Msg e ->
    Logs.warn (fun m -> m "Failed to get commit id: %s" e);
    default

  2. Use git config author as the default author and "The Robur Team team@robur.coop" as a last resort.
I tested this on a fork, and to my surprise the remote needs a #branch otherwise it pushes to main (undesirable). So I changed the help text to be more explicit about that. Below is a commit with this, and the only change is new feeds (atom and rss1). https://git.robur.coop/reynir/blog.robur.coop/commit/534480737cc70ce63f5dd97e1adf9a148b3280fb I think we should merge this then. Things that would be nice to have (later): 1. Have the commit message include from what it was built, see https://git.robur.coop/robur/blog.robur.coop/src/commit/aa6bcc5277cd3839955e3b093104fc5853daef99/src/blogger.ml#L134-L149 1. Use git config author as the default author and "The Robur Team <team@robur.coop>" as a last resort.
reynir merged commit e54e40c6aa into main 2024-10-04 11:24:35 +00:00
reynir deleted branch yocaml2 2024-10-04 11:24:35 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: robur/blog.robur.coop#2
No description provided.