Skip to content

Commit

Permalink
(ood-gen) Remove option from Release.t.is_latest and Release.t.is_lts (
Browse files Browse the repository at this point in the history
  • Loading branch information
egmaleta authored Feb 16, 2024
1 parent 8d50a1b commit 853c3fd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/ocamlorg_data/data.mli
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,8 @@ module Release : sig
kind : kind;
version : string;
date : string;
is_latest : bool option;
is_lts : bool option;
is_latest : bool;
is_lts : bool;
intro_md : string;
intro_html : string;
highlights_md : string;
Expand Down
15 changes: 9 additions & 6 deletions tool/ood-gen/lib/release.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ type t = {
kind : Kind.t;
version : string;
date : string;
is_latest : bool option;
is_lts : bool option;
is_latest : bool;
is_lts : bool;
intro_md : string;
intro_html : string;
highlights_md : string;
Expand All @@ -34,6 +34,7 @@ type t = {
}
[@@deriving
stable_record ~version:metadata ~add:[ intro; highlights ]
~modify:[ is_latest; is_lts ]
~remove:
[
intro_md; intro_html; highlights_md; highlights_html; body_md; body_html;
Expand All @@ -50,6 +51,8 @@ let of_metadata m =
(Cmarkit.Doc.of_string ~strict:true m.highlights
|> Hilite.Md.transform
|> Cmarkit_html.of_doc ~safe:false)
~modify_is_latest:(Option.value ~default:false)
~modify_is_lts:(Option.value ~default:false)

let sort_by_decreasing_version x y =
let to_list s = List.map int_of_string_opt @@ String.split_on_char '.' s in
Expand All @@ -72,15 +75,15 @@ let all () =
let template () =
let all = all () in
let latest =
try List.find (fun r -> r.is_latest = Some true) all
try List.find (fun r -> r.is_latest) all
with Not_found ->
raise
(Invalid_argument
"none of the releases in data/releases is marked with is_latest: \
true")
in
let lts =
try List.find (fun r -> r.is_lts = Some true) all
try List.find (fun r -> r.is_lts) all
with Not_found ->
raise
(Invalid_argument
Expand All @@ -94,8 +97,8 @@ type t =
{ kind : kind
; version : string
; date : string
; is_latest: bool option
; is_lts: bool option
; is_latest: bool
; is_lts: bool
; intro_md : string
; intro_html : string
; highlights_md : string
Expand Down

0 comments on commit 853c3fd

Please sign in to comment.