From 5ab8f59624e66c5be23b4bd6fd2bff3e8d5a7e02 Mon Sep 17 00:00:00 2001 From: John Muschelli Date: Fri, 8 Oct 2021 20:43:18 +0000 Subject: [PATCH 1/3] added copy export, to fix #171 --- NAMESPACE | 1 + R/Class-Copy.R | 2 ++ man/Copy-class.Rd | 1 + 3 files changed, 4 insertions(+) diff --git a/NAMESPACE b/NAMESPACE index 38e1aa3..ae356e5 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -7,6 +7,7 @@ export(CMD_Render) export(CMD_Rscript) export(Cmd) export(Comment) +export(Copy) export(Entrypoint) export(Expose) export(Label) diff --git a/R/Class-Copy.R b/R/Class-Copy.R index 29f8d25..c3c6a86 100644 --- a/R/Class-Copy.R +++ b/R/Class-Copy.R @@ -13,6 +13,7 @@ #' @family instruction classes #' @examples #' #no example yet +#' Copy("here", "/here") setClass("Copy", slots = list(src = "character", dest = "character"), contains = "Instruction") @@ -26,6 +27,7 @@ setClass("Copy", #' @param addTrailingSlashes (boolean) add trailing slashes to the given paths if the source is an existing directory #' #' @return the object +#' @export #' @importFrom fs dir_exists #' @importFrom stringr str_detect Copy <- function(src, dest, addTrailingSlashes = TRUE) { diff --git a/man/Copy-class.Rd b/man/Copy-class.Rd index 7772447..ebd235c 100644 --- a/man/Copy-class.Rd +++ b/man/Copy-class.Rd @@ -17,6 +17,7 @@ S4 Class representing a COPY-instruction } \examples{ #no example yet +Copy("here", "/here") } \seealso{ Other instruction classes: From ad38fe717c3beb7c9cb10861d6f16e10208ad0f0 Mon Sep 17 00:00:00 2001 From: John Muschelli Date: Fri, 8 Oct 2021 21:14:46 +0000 Subject: [PATCH 2/3] Fixing #191 when no DESCRIPTION --- R/utility-functions.R | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/R/utility-functions.R b/R/utility-functions.R index dcf7d04..858e363 100644 --- a/R/utility-functions.R +++ b/R/utility-functions.R @@ -190,11 +190,18 @@ getRVersionTag <- function(from, default = paste(R.Version()$major, R.Version()$ } else if (inherits(from, "description")) { # get R: stringr::str_extract(string = "methods, R (1.2.3,test), test (9.9)", pattern = "R( \\(.*?\\))?") # get version: stringr::str_extract(string = "R (1.2.3)", pattern = "(?<=\\().+?(?=\\))") - r_depends <- stringr::str_extract(string = from$get_field("Depends"), pattern = "R( \\(.*?\\))?") + r_depends <- stringr::str_extract(string = from$get_field("Depends", default = NULL), pattern = "R( \\(.*?\\))?") r_version <- stringr::str_extract(string = stringr::str_extract(string = r_depends, pattern = "(?<=\\().+?(?=\\))"), pattern = "(\\d).*") # everything after the first digit - } else if (!is.null(from) + if (length(r_version) == 0 || nchar(n_version) == 0) { + warning(paste0("No R version in DESCRIPTION file, using sessionInfo(). ", + "Set Depends: R (>= VERSION) to override")) + temp_from <- sessionInfo() + r_version <- paste(temp_from$R.version$major, temp_from$R.version$minor, sep = ".") + futile.logger::flog.debug("Got R version from sessionInfo: %s", r_version) + } + r} else if (!is.null(from) && !is.expression(from) && !is.na(from) && file.exists(from)) { From 8ea06886e07a9e04e2777506a4beab2c94e4ff33 Mon Sep 17 00:00:00 2001 From: John Muschelli Date: Fri, 8 Oct 2021 21:17:31 +0000 Subject: [PATCH 3/3] fixing typo --- R/utility-functions.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/utility-functions.R b/R/utility-functions.R index 858e363..a063e08 100644 --- a/R/utility-functions.R +++ b/R/utility-functions.R @@ -201,7 +201,7 @@ getRVersionTag <- function(from, default = paste(R.Version()$major, R.Version()$ r_version <- paste(temp_from$R.version$major, temp_from$R.version$minor, sep = ".") futile.logger::flog.debug("Got R version from sessionInfo: %s", r_version) } - r} else if (!is.null(from) + } else if (!is.null(from) && !is.expression(from) && !is.na(from) && file.exists(from)) {