From 6ccbdd9346be853c2a0948884cf9be806b3c164e Mon Sep 17 00:00:00 2001 From: Troejelsgaard Date: Tue, 3 Dec 2024 14:10:57 +0100 Subject: [PATCH 1/7] Fixing bug in the hyperlink in the summary file --- R/render_summary.R | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/R/render_summary.R b/R/render_summary.R index f8f4610..1545a09 100644 --- a/R/render_summary.R +++ b/R/render_summary.R @@ -50,9 +50,11 @@ knit_print.whirl_summary_info <- function(x, path_rel_start, ...) { ncols <- ncol(hold) if (grepl("rstudio_cloud", Sys.getenv("R_CONFIG_ACTIVE"))) { - formatted <- file.path("/file_show?path=", hold[["Hyperlink"]]) + formatted <- file.path("/file_show?path=", hold$"Hyperlink") } else { - formatted <- file.path(path_rel(hold[["Hyperlink"]], start = path_rel_start)) + formatted <- lapply(hold$"Hyperlink", path_rel, start = path_rel_start) |> + unlist() |> + file.path() } hold$Hyperlink <- paste0(sprintf('%s', formatted, "HTML Log")) From 7fb553f4f0920d8f3845d427ff6d497ccfa76be3 Mon Sep 17 00:00:00 2001 From: Troejelsgaard Date: Wed, 4 Dec 2024 13:58:08 +0100 Subject: [PATCH 2/7] Update title with basename and include path in title block. --- inst/.gitignore | 1 + inst/documents/log.qmd | 5 ++++- inst/documents/title-block.html | 35 +++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 inst/documents/title-block.html diff --git a/inst/.gitignore b/inst/.gitignore index 544fe25..ab272ae 100644 --- a/inst/.gitignore +++ b/inst/.gitignore @@ -3,3 +3,4 @@ *.html *.json *_files/* +!documents/title-block.html diff --git a/inst/documents/log.qmd b/inst/documents/log.qmd index f3dc745..472dcbc 100644 --- a/inst/documents/log.qmd +++ b/inst/documents/log.qmd @@ -1,7 +1,10 @@ --- -title: "`r params$title`" +title: "`r basename(params$title)`" date: "`r Sys.time()`" date-format: "YYYY-MM-DDTHH:mm:ss zzz" +abstract: "`r params$title`" +template-partials: + - title-block.html params: title: 'dev' check_approved_folder_pkgs: NULL diff --git a/inst/documents/title-block.html b/inst/documents/title-block.html new file mode 100644 index 0000000..8701634 --- /dev/null +++ b/inst/documents/title-block.html @@ -0,0 +1,35 @@ +
+
+

$title$

+$if(subtitle)$ +

$subtitle$

+$endif$ +$for(author)$ +

$author$

+$endfor$ + +$if(date)$ +
+
$labels.published$
+
+

$date$

+
+
+$endif$ + +$if(date-modified)$ +
+
$labels.modified$
+
+

$date-modified$

+
+
+$endif$ + +$for(abstract)$ +
+
Path
+ $abstract$ +
+$endfor$ +
From ebe9d6bb220670c429876e9e91e599e30ffd7240 Mon Sep 17 00:00:00 2001 From: Troejelsgaard Date: Wed, 4 Dec 2024 15:47:53 +0100 Subject: [PATCH 3/7] Adding line break to prettify the printing --- R/internal_run.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/internal_run.R b/R/internal_run.R index 88e941f..056b865 100644 --- a/R/internal_run.R +++ b/R/internal_run.R @@ -42,6 +42,7 @@ internal_run <- function(input, steps, queue, level, } else { # Execute the scripts queue$run(files) + cat("\n") } } From 1a0f8938dae5af723051652eef2b2c112281152f Mon Sep 17 00:00:00 2001 From: Troejelsgaard Date: Thu, 5 Dec 2024 09:12:16 +0100 Subject: [PATCH 4/7] Update to title-block.html --- inst/documents/title-block.html | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/inst/documents/title-block.html b/inst/documents/title-block.html index 8701634..a9cf25b 100644 --- a/inst/documents/title-block.html +++ b/inst/documents/title-block.html @@ -10,7 +10,7 @@

$title$

$if(date)$
-
$labels.published$
+
Execution time

$date$

@@ -19,17 +19,19 @@

$title$

$if(date-modified)$
-
$labels.modified$
+
Execution time

$date-modified$

$endif$ -$for(abstract)$ -
-
Path
- $abstract$ +$if(abstract)$ +
+
Path to script
+
+

$abstract$

-$endfor$ +
+$endif$ From c4a80a0d374ada0fe735cb0cebf1b0f0a4ff422d Mon Sep 17 00:00:00 2001 From: Troejelsgaard Date: Thu, 5 Dec 2024 09:12:39 +0100 Subject: [PATCH 5/7] Update to config step names --- tests/testthat/scripts/_whirl_to_config.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/testthat/scripts/_whirl_to_config.yaml b/tests/testthat/scripts/_whirl_to_config.yaml index 6936d45..4c4d23b 100644 --- a/tests/testthat/scripts/_whirl_to_config.yaml +++ b/tests/testthat/scripts/_whirl_to_config.yaml @@ -1,4 +1,7 @@ steps: - - name: "Run config file" + - name: "Run _whirl.yaml" paths: - "_whirl.yaml" + - name: "Run _whirl_unnamed.yaml" + paths: + - "_whirl_unnamed.yaml" From 66aeccdcb58317e40c70356bd72ac8b68264933b Mon Sep 17 00:00:00 2001 From: Troejelsgaard Date: Fri, 6 Dec 2024 10:03:11 +0100 Subject: [PATCH 6/7] Updating NEWS and DESCRIPTION --- DESCRIPTION | 2 +- NEWS.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 465f199..5c19ca9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: whirl Title: Logging package -Version: 0.1.6 +Version: 0.1.6.9000 Authors@R: c( person("Aksel", "Thomsen", , "oath@novonordisk.com", role = c("aut", "cre")), person("Lovemore", "Gakava", , "lvgk@novonordisk.com", role = "aut"), diff --git a/NEWS.md b/NEWS.md index 1667847..bf898a2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# whirl (development version) +* Changed the title on the individual logs to the script name and moved the path to a distinct section within the title-block. +* Fixed a bug where the hyperlink in the summary files was not rendered correctly. + # whirl 0.1.6 (2024-11-25) * Added support for logging of Python scripts with `run()`. * Improved unit tests for `run()` From 692a9c3e87aa676aafab41d5b696dfe5bb95ac14 Mon Sep 17 00:00:00 2001 From: Troejelsgaard Date: Fri, 6 Dec 2024 13:29:22 +0100 Subject: [PATCH 7/7] Updates based on review comments --- R/internal_run.R | 6 +++++- inst/documents/title-block.html | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/R/internal_run.R b/R/internal_run.R index 056b865..afc847d 100644 --- a/R/internal_run.R +++ b/R/internal_run.R @@ -42,7 +42,11 @@ internal_run <- function(input, steps, queue, level, } else { # Execute the scripts queue$run(files) - cat("\n") + zephyr::msg("\n", + msg_fun = cli::cli_verbatim, + levels_to_write = "verbose", + verbosity_level = verbosity_level) + } } diff --git a/inst/documents/title-block.html b/inst/documents/title-block.html index a9cf25b..118b19b 100644 --- a/inst/documents/title-block.html +++ b/inst/documents/title-block.html @@ -10,7 +10,7 @@

$title$

$if(date)$
-
Execution time
+
Execution end time

$date$