Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### unreleased

- Fix typos and improve logs display (by [clementd](https://clementd.wtf))

### v2.8.0 2025-12-17 Nantes (France)

#### Yocaml
Expand Down
2 changes: 1 addition & 1 deletion lib/core/data.mli
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ module Validation : sig
-> (t -> 'a validated_value)
-> 'a validated_record
(** [optional_or ~default assoc field validator] optional [field] of [assoc],
validated by [validator]. If the field does not exists, it return default.
validated by [validator]. If the field does not exist, it returns default.
([default] is not validated) *)

val field :
Expand Down
4 changes: 2 additions & 2 deletions lib/core/eff.ml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ let erase_file ~on path =
if file then perform @@ Yocaml_erase_file (on, path)
else
logf ~src:yocaml_log_src ~level:`Warning
"%a is not a file (or does not exists)" Path.pp path
"%a is not a file (or does not exist)" Path.pp path

let read_directory ~on ?(only = `Both) ?(where = fun _ -> true) path =
let* is_dir = is_directory ~on path in
Expand All @@ -237,7 +237,7 @@ let read_directory ~on ?(only = `Both) ?(where = fun _ -> true) path =
List.filter_map predicate children
else
let+ () =
logf ~src:yocaml_log_src ~level:`Warning "%a does not exists" Path.pp path
logf ~src:yocaml_log_src ~level:`Warning "%a does not exist" Path.pp path
in
[]

Expand Down
8 changes: 4 additions & 4 deletions lib/core/eff.mli
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,10 @@ val run : ('b, 'c) Effect.Deep.handler -> ('a -> 'b t) -> 'a -> 'c
Exception that can be propagated by the performance of effects. *)

exception File_not_exists of filesystem * Path.t
(** Exception raised when a file does not exists. *)
(** Exception raised when a file does not exist. *)

exception Invalid_path of filesystem * Path.t
(** Exception raised when a file does not has a basename. *)
(** Exception raised when a file does not have a basename. *)

exception File_is_a_directory of filesystem * Path.t
(** Exception raised when we try to use a directory as a regular file. *)
Expand Down Expand Up @@ -358,7 +358,7 @@ val file_exists : on:filesystem -> Path.t -> bool t
val read_file : ?snapshot:bool -> on:filesystem -> Path.t -> string t
(** [read_file ?snapshot ~on path] perform the effect [Yocaml_read_file] with a
given [path] and try to read it. Perform [Yocaml_failwith] with
{!exception:File_not_exists} if the file does not exists. [snapshot] is used
{!exception:File_not_exists} if the file does not exist. [snapshot] is used
to perform a snapshot of the file. *)

val read_file_as_metadata :
Expand Down Expand Up @@ -392,7 +392,7 @@ val read_file_with_metadata :
val mtime : on:filesystem -> Path.t -> int t
(** [mtime ~on path] perform the effect [Yocaml_source_get_mtime] with a given
[path] and try to get the modification time. Perform [Yocaml_failwith] with
{!exception:File_not_exists} if the file does not exists.
{!exception:File_not_exists} if the file does not exist.

The logic of [mtime] differs slightly from that of Unix. If a directory is
given as an argument, the function will return the largest [mtime]
Expand Down
4 changes: 2 additions & 2 deletions lib/core/lexicon.ml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ let unknown_error ppf exn =
(Printexc.to_string exn)

let file_not_exists source path ppf () =
Format.fprintf ppf "The file `%a` (on `%a`) does not exists" Path.pp path
Format.fprintf ppf "The file `%a` (on `%a`) does not exist" Path.pp path
pp_filesystem source

let invalid_path source path ppf () =
Expand All @@ -114,6 +114,6 @@ let directory_is_a_file source path ppf () =

let directory_not_exists source path ppf () =
Format.fprintf ppf
"The following directory: `%a` (on `%a`) does not exists (or is maybe a \
"The following directory: `%a` (on `%a`) does not exist (or is maybe a \
file and not a directory)"
Path.pp path pp_filesystem source
2 changes: 1 addition & 1 deletion lib/runtime/log.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ let level_to_logs = function

let msg ?src level message =
let level = level_to_logs level in
Logs.msg ?src level (fun print -> print "%s" message)
Logs.msg ?src level (fun print -> print " %s" message)

let setup ?level () =
match level with
Expand Down
106 changes: 53 additions & 53 deletions test/e2e/run.t
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
Run the generator
$ ./bin/gen.exe
./bin/gen.exe
[DEBUG]Trigger in ./
[DEBUG]Cache initiated in `./_www/.cache`
[DEBUG]`./_www/style.css` will be written
[INFO]`./_www/style.css` has been written
[DEBUG]`./_www/articles/first_article.html` will be written
[INFO]`./_www/articles/first_article.html` has been written
[DEBUG]./content/templates/article.html already stored
[DEBUG]./content/templates/layout.html already stored
[DEBUG]`./_www/articles/second_article.html` will be written
[INFO]`./_www/articles/second_article.html` has been written
[DEBUG]./content/templates/article.html already stored
[DEBUG]./content/templates/layout.html already stored
[DEBUG]`./_www/articles-with-applicative-read/first_article.html` will be written
[INFO]`./_www/articles-with-applicative-read/first_article.html` has been written
[DEBUG]./content/templates/article.html already stored
[DEBUG]./content/templates/layout.html already stored
[DEBUG]`./_www/articles-with-applicative-read/second_article.html` will be written
[INFO]`./_www/articles-with-applicative-read/second_article.html` has been written
[DEBUG]./content/templates/article.html already stored
[DEBUG]./content/templates/layout.html already stored
[DEBUG]`./_www/articles-with-applicative-read-2/first_article.html` will be written
[INFO]`./_www/articles-with-applicative-read-2/first_article.html` has been written
[DEBUG]./content/templates/article.html already stored
[DEBUG]./content/templates/layout.html already stored
[DEBUG]`./_www/articles-with-applicative-read-2/second_article.html` will be written
[INFO]`./_www/articles-with-applicative-read-2/second_article.html` has been written
[DEBUG]Cache stored in `./_www/.cache`
[DEBUG] Trigger in ./
[DEBUG] Cache initiated in `./_www/.cache`
[DEBUG] `./_www/style.css` will be written
[INFO] `./_www/style.css` has been written
[DEBUG] `./_www/articles/first_article.html` will be written
[INFO] `./_www/articles/first_article.html` has been written
[DEBUG] ./content/templates/article.html already stored
[DEBUG] ./content/templates/layout.html already stored
[DEBUG] `./_www/articles/second_article.html` will be written
[INFO] `./_www/articles/second_article.html` has been written
[DEBUG] ./content/templates/article.html already stored
[DEBUG] ./content/templates/layout.html already stored
[DEBUG] `./_www/articles-with-applicative-read/first_article.html` will be written
[INFO] `./_www/articles-with-applicative-read/first_article.html` has been written
[DEBUG] ./content/templates/article.html already stored
[DEBUG] ./content/templates/layout.html already stored
[DEBUG] `./_www/articles-with-applicative-read/second_article.html` will be written
[INFO] `./_www/articles-with-applicative-read/second_article.html` has been written
[DEBUG] ./content/templates/article.html already stored
[DEBUG] ./content/templates/layout.html already stored
[DEBUG] `./_www/articles-with-applicative-read-2/first_article.html` will be written
[INFO] `./_www/articles-with-applicative-read-2/first_article.html` has been written
[DEBUG] ./content/templates/article.html already stored
[DEBUG] ./content/templates/layout.html already stored
[DEBUG] `./_www/articles-with-applicative-read-2/second_article.html` will be written
[INFO] `./_www/articles-with-applicative-read-2/second_article.html` has been written
[DEBUG] Cache stored in `./_www/.cache`

Inspect tree
$ tree _www
Expand Down Expand Up @@ -204,15 +204,15 @@ Inspect Second Applicative read (same content of article)
Run the Liquid generator
$ ./bin/gen_liquid.exe
./bin/gen_liquid.exe
[DEBUG]Trigger in ./
[DEBUG]Cache restored from `./_www/.cache`
[DEBUG]`./_www/liquid-articles/first_article.html` will be written
[INFO]`./_www/liquid-articles/first_article.html` has been written
[DEBUG]./content/templates/article.liquid already stored
[DEBUG]./content/templates/layout.liquid already stored
[DEBUG]`./_www/liquid-articles/second_article.html` will be written
[INFO]`./_www/liquid-articles/second_article.html` has been written
[DEBUG]Cache stored in `./_www/.cache`
[DEBUG] Trigger in ./
[DEBUG] Cache restored from `./_www/.cache`
[DEBUG] `./_www/liquid-articles/first_article.html` will be written
[INFO] `./_www/liquid-articles/first_article.html` has been written
[DEBUG] ./content/templates/article.liquid already stored
[DEBUG] ./content/templates/layout.liquid already stored
[DEBUG] `./_www/liquid-articles/second_article.html` will be written
[INFO] `./_www/liquid-articles/second_article.html` has been written
[DEBUG] Cache stored in `./_www/.cache`
Inspect tree after Liquid generation
$ tree _www
_www
Expand Down Expand Up @@ -278,17 +278,17 @@ Inspect Liquid Second Article
Observe Residual Removing
$ ./bin/gen_residuals.exe
./bin/gen_residuals.exe
[DEBUG]Cache initiated in `./residuals_build/cache`
[DEBUG]`./residuals_build/1.txt` will be written
[INFO]`./residuals_build/1.txt` has been written
[DEBUG]`./residuals_build/2.txt` will be written
[INFO]`./residuals_build/2.txt` has been written
[DEBUG]`./residuals_build/3.txt` will be written
[INFO]`./residuals_build/3.txt` has been written
[INFO]Remove residuals for ./residuals_build
[INFO]./residuals_build/4.txt deleted!
[INFO]./residuals_build/5.txt deleted!
[DEBUG]Cache stored in `./residuals_build/cache`
[DEBUG] Cache initiated in `./residuals_build/cache`
[DEBUG] `./residuals_build/1.txt` will be written
[INFO] `./residuals_build/1.txt` has been written
[DEBUG] `./residuals_build/2.txt` will be written
[INFO] `./residuals_build/2.txt` has been written
[DEBUG] `./residuals_build/3.txt` will be written
[INFO] `./residuals_build/3.txt` has been written
[INFO] Remove residuals for ./residuals_build
[INFO] ./residuals_build/4.txt deleted!
[INFO] ./residuals_build/5.txt deleted!
[DEBUG] Cache stored in `./residuals_build/cache`

$ ls residuals_build
1.txt
Expand All @@ -298,12 +298,12 @@ Observe Residual Removing

$ ./bin/gen_residuals.exe
./bin/gen_residuals.exe
[DEBUG]Cache restored from `./residuals_build/cache`
[DEBUG]`./residuals_build/1.txt` always has the same hash as in the cache, already up-to-date
[DEBUG]`./residuals_build/2.txt` always has the same hash as in the cache, already up-to-date
[DEBUG]`./residuals_build/3.txt` always has the same hash as in the cache, already up-to-date
[INFO]Remove residuals for ./residuals_build
[DEBUG]Cache stored in `./residuals_build/cache`
[DEBUG] Cache restored from `./residuals_build/cache`
[DEBUG] `./residuals_build/1.txt` always has the same hash as in the cache, already up-to-date
[DEBUG] `./residuals_build/2.txt` always has the same hash as in the cache, already up-to-date
[DEBUG] `./residuals_build/3.txt` always has the same hash as in the cache, already up-to-date
[INFO] Remove residuals for ./residuals_build
[DEBUG] Cache stored in `./residuals_build/cache`

$ ls residuals_build
1.txt
Expand Down
4 changes: 2 additions & 2 deletions test/lib/fs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ let run ~trace program input =
match get !trace.system path with
| Some (Dir _) -> true
| _ -> false
(* We suppose that if a file does not exists,
(* We suppose that if a file does not exist,
it is not a directory... *)
in
continue k res)
Expand All @@ -379,7 +379,7 @@ let run ~trace program input =
match get !trace.system path with
| Some (File _) -> true
| _ -> false
(* We suppose that if a file does not exists,
(* We suppose that if a file does not exist,
it is not a file... *)
in
continue k res)
Expand Down
20 changes: 10 additions & 10 deletions test/lib/gen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

let csexp =
let open QCheck2.Gen in
let atom = small_string ~gen:printable |> map Yocaml.Sexp.atom in
let node self n = small_list (self (n / 10)) |> map Yocaml.Sexp.node in
let atom = string_small |> map Yocaml.Sexp.atom in
let node self n = list_small (self (n / 10)) |> map Yocaml.Sexp.node in
fix (fun self -> function
| 0 -> atom
| n -> frequency [ (1, atom); (5, node self n) ])
| n -> oneof_weighted [ (1, atom); (5, node self n) ])
|> sized

let alphanumeric =
Expand All @@ -32,20 +32,20 @@ let sexp =
let atom =
string_size ~gen:alphanumeric (int_range 1 100) |> map Yocaml.Sexp.atom
in
let node self n = small_list (self (n / 10)) |> map Yocaml.Sexp.node in
let node self n = list_small (self (n / 10)) |> map Yocaml.Sexp.node in
fix (fun self -> function
| 0 -> atom
| n -> frequency [ (1, atom); (5, node self n) ])
| n -> oneof_weighted [ (1, atom); (5, node self n) ])
|> sized

let path =
let open QCheck2.Gen in
let fragment =
string_size ~gen:(char_range 'a' 'z') (int_range 1 10) |> small_list
string_size ~gen:(char_range 'a' 'z') (int_range 1 10) |> list_small
in
let rel = fragment |> map Yocaml.Path.rel in
let abs = fragment |> map Yocaml.Path.abs in
frequency [ (5, rel); (5, abs) ]
oneof_weighted [ (5, rel); (5, abs) ]

let deps =
let open QCheck2.Gen in
Expand All @@ -56,8 +56,8 @@ let cache_entry =
map3
(fun last_build_date hash deps ->
Yocaml.Cache.entry ?last_build_date hash deps)
(opt int)
(small_string ~gen:printable)
(option int)
string_small
deps

let cache =
Expand All @@ -67,4 +67,4 @@ let cache =
let+ k = path in
(k, v)
in
line |> small_list |> map Yocaml.Cache.from_list
line |> list_small |> map Yocaml.Cache.from_list
Loading