From d13e25739e659a919197d6634e9b345efd2fe6f9 Mon Sep 17 00:00:00 2001 From: Lovemore-Gakava Date: Fri, 4 Oct 2024 11:53:52 +0200 Subject: [PATCH 1/2] fix: - updated location of temporary files for md - updated name of log to end in _log_.md - used options for create_outputs format argument --- R/mdformats.R | 15 ++++----------- R/whirl_queue.R | 2 +- R/whirl_r_session.R | 3 ++- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/R/mdformats.R b/R/mdformats.R index 419aac2..a086fb1 100644 --- a/R/mdformats.R +++ b/R/mdformats.R @@ -1,13 +1,13 @@ #' @noRd -mdformats <- function(script, log_html, mdfmt, out_dir) { +mdformats <- function(script, log_html, mdfmt, self, out_dir) { newname <- gsub( pattern = "\\.[^\\.]*$", replacement = "", x = basename(script) ) - if (length(mdfmt) > 1) { - newname <- paste0(newname, "_", mdfmt) + if (length(mdfmt) >= 1) { + newname <- paste0(newname, "_log_", mdfmt) } newname <- paste0(newname, ".md") @@ -20,14 +20,7 @@ mdformats <- function(script, log_html, mdfmt, out_dir) { ) file.copy( - from = file.path( - tempdir(), - gsub( - pattern = "\\.[^\\.]*$", - replacement = ".md", - x = basename(log_html) - ) - ), + from = file.path(self$get_wd(), "log.md"), to = file.path( out_dir, newname[[i]] diff --git a/R/whirl_queue.R b/R/whirl_queue.R index b367987..7f72851 100644 --- a/R/whirl_queue.R +++ b/R/whirl_queue.R @@ -200,7 +200,7 @@ wq_next_step <- function(self, private, wid) { purrr::pluck(private$.queue, "result", id_script) <- session$ log_finish()$ create_outputs(out_dir = dirname(purrr::pluck(private$.queue, "script", id_script)), - format = "html") + format = options::opt("out_formats", env = "whirl")) purrr::pluck(private$.queue, "status", id_script) <- purrr::pluck(private$.queue, "result", id_script, "status", "status") diff --git a/R/whirl_r_session.R b/R/whirl_r_session.R index 685e34a..6602f23 100644 --- a/R/whirl_r_session.R +++ b/R/whirl_r_session.R @@ -349,7 +349,8 @@ wrs_create_outputs <- function(out_dir, format, self, private, super) { script = private$current_script, log_html = file.path(self$get_wd(), "log.html"), mdfmt = format[format %in% c("gfm", "commonmark", "markua")], - out_dir = out_dir + out_dir = out_dir, + self = self ) } From 58b2ee895ccf2b186af4fe79673f0bba44dbe43c Mon Sep 17 00:00:00 2001 From: Aksel Thomsen Date: Mon, 7 Oct 2024 18:34:58 +0200 Subject: [PATCH 2/2] Update DESCRIPTION Signed-off-by: Aksel Thomsen --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 3c976eb..b0e6c55 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: whirl Title: Logging package -Version: 0.1.0 +Version: 0.1.1 Authors@R: c( person("Aksel", "Thomsen", , "oath@novonordisk.com", role = c("aut", "cre")), person("Lovemore", "Gakava", , "lvgk@novonordisk.com", role = "aut"),