diff --git a/NEWS.md b/NEWS.md index c78bd6da4..18c96460a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# Version 6.2.1 + +Version 6.2.1 is a hotfix to address the failing automated CRAN checks for 6.2.0. Chiefly, in CRAN's Debian R-devel (2018-12-10) check platform, errors of the form "length > 1 in coercion to logical" occurred when either argument to `&&` or `||` was not of length 1 (e.g. `nzchar(letters) && length(letters)`). In addition to fixing these errors, version 6.2.1 also removes a problematic link from the vignette. + # Version 6.2.0 ## New features diff --git a/R/create_drake_layout.R b/R/create_drake_layout.R index 6d892de5e..742a8ea05 100644 --- a/R/create_drake_layout.R +++ b/R/create_drake_layout.R @@ -150,7 +150,7 @@ cdl_prepare_layout <- function(layout, config){ layout$command, config = config ) - if (is.null(layout$trigger) || is.na(layout$trigger)){ + if (is.null(layout$trigger) || all(is.na(layout$trigger))){ layout$trigger <- config$trigger layout$deps_condition <- config$default_condition_deps layout$deps_change <- config$default_change_deps diff --git a/R/dependencies.R b/R/dependencies.R index c57a1a99c..b19505c79 100644 --- a/R/dependencies.R +++ b/R/dependencies.R @@ -74,7 +74,7 @@ deps_code <- function(x) { if (is.function(x)) { import_dependencies(x) - } else if (is_file(x) && file.exists(drake_unquote(x))) { + } else if (all(is_file(x)) && all(file.exists(drake_unquote(x)))) { knitr_deps(drake_unquote(x)) } else if (is.character(x)) { command_dependencies(x) diff --git a/R/test.R b/R/test.R index cc23b5114..962ac675c 100644 --- a/R/test.R +++ b/R/test.R @@ -123,3 +123,38 @@ write_v4.3.0_project <- function() { # nolint ) unzip(zip, exdir = ".", setTimes = TRUE) } + +# Some installations of R require the && and || operators +# to return a result of length 1. +# For example, `nzchar(letters) && length(letters)` fails on +# some platforms but not others. Below, we mock the operators +# to preempt these elusive failures. +# Below, toggle the if() condition on in test mode +# and off in production mode. +# nocov start +if (FALSE) { + `&&` <- function(x, y) { + if (length(x) != 1) { + stop("length x not 1") + } else if (!x) { + return(x) + } + if (length(y) != 1) { + stop("length y not 1") + } + y + } + + `||` <- function(x, y) { + if (length(x) != 1) { + stop("length x not 1") + } else if (x) { + return(x) + } + if (length(y) != 1) { + stop("length y not 1") + } + y + } +} +# nocov end diff --git a/tests/testthat/test-dependencies.R b/tests/testthat/test-dependencies.R index 36c802344..34cbff12d 100644 --- a/tests/testthat/test-dependencies.R +++ b/tests/testthat/test-dependencies.R @@ -77,7 +77,6 @@ test_with_dir( expect_equal(length(command_dependencies(character(0))), 0) expect_equal(clean_dependency_list(deps_code(base::c)), character(0)) expect_equal(clean_dependency_list(deps_code(base::list)), character(0)) - expect_equal(clean_dependency_list(deps_code(NA)), character(0)) f <- function(x, y) { out <- x + y + g(x) saveRDS(out, "out.rds") diff --git a/vignettes/drake.Rmd b/vignettes/drake.Rmd index da533dbfa..3186ffdb4 100644 --- a/vignettes/drake.Rmd +++ b/vignettes/drake.Rmd @@ -72,7 +72,10 @@ If you have a project of your own, we would love to add it. [Click here to edit ## Context and history -For context and history, check out [this post on the rOpenSci blog](https://ropensci.org/blog/2018/02/06/drake/) and [episode 22 of the R Podcast](https://www.r-podcast.org/episode/022-diving-in-to-drake-with-will-landau/). +For context and history, please refer to the following. + +- The rOpenSci blog post from February 6, 2018. +- Episode 22 of the R-Podcast. # Acknowledgements