Skip to content

Commit eb94a95

Browse files
committed
CRAN patch 3
1 parent 144b1bb commit eb94a95

File tree

8 files changed

+37
-14
lines changed

8 files changed

+37
-14
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Description: Pipeline tools coordinate the pieces of computationally
1212
The methodology in this package
1313
borrows from GNU 'Make' (2015, ISBN:978-9881443519)
1414
and 'drake' (2018, <doi:10.21105/joss.00550>).
15-
Version: 1.1.2.9000
15+
Version: 1.1.3
1616
License: MIT + file LICENSE
1717
URL: https://docs.ropensci.org/targets/, https://github.com/ropensci/targets
1818
BugReports: https://github.com/ropensci/targets/issues

NEWS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# targets 1.1.2.9000
2-
1+
# targets 1.1.3
32

3+
* Decide on `nanonext` usage in `time_seconds_local()` at runtime and not installation time. That way, if `nanonext` is removed after `targets` is installed, functions in `targets` still work. Fixes the CRAN issues seen in `tarchetypes`, `jagstargets`, and `gittargets`.
44

55
# targets 1.1.2
66

R/class_runtime.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ runtime_new <- function(
99
gcp_auth = NULL,
1010
file_exist = NULL,
1111
file_info = NULL,
12-
file_info_exist = NULL
12+
file_info_exist = NULL,
13+
nanonext = NULL
1314
) {
1415
force(target)
1516
force(frames)
@@ -22,6 +23,7 @@ runtime_new <- function(
2223
force(file_exist)
2324
force(file_info)
2425
force(file_info_exist)
26+
force(nanonext)
2527
environment()
2628
}
2729

@@ -61,7 +63,6 @@ runtime_validate <- function(x) {
6163
if (!is.null(x$gcp_auth)) {
6264
tar_assert_scalar(x$gcp_auth)
6365
tar_assert_lgl(x$gcp_auth)
64-
tar_assert_nzchar(x$gcp_auth)
6566
}
6667
if (!is.null(x$file_exist)) {
6768
tar_assert_envir(x$file_exist)
@@ -73,6 +74,10 @@ runtime_validate <- function(x) {
7374
if (!is.null(x$file_info_exist)) {
7475
tar_assert_envir(x$file_info_exist)
7576
}
77+
if (!is.null(x$nanonext)) {
78+
tar_assert_scalar(x$nanonext)
79+
tar_assert_lgl(x$nanonext)
80+
}
7681
}
7782

7883
#' @title Get the `tar_runtime` object.

R/utils_time.R

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@ time_seconds <- function() {
1414
)
1515
}
1616

17-
# not possible to cover both cases
18-
# nocov start
19-
if (length(find.package("nanonext", quiet = TRUE)) > 0L) {
20-
time_seconds_local <- function() {
21-
nanonext::mclock() / 1e3
17+
time_seconds_local <- function() {
18+
if (is.null(tar_runtime$nanonext)) {
19+
tar_runtime$nanonext <- rlang::is_installed("nanonext")
2220
}
23-
} else {
24-
time_seconds_local <- function() {
21+
if_any(
22+
tar_runtime$nanonext,
23+
nanonext::mclock() / 1e3,
2524
as.numeric(proc.time()["elapsed"])
26-
}
25+
)
2726
}
28-
# nocov end

tests/testthat/test-class_aws.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ tar_test("deprecated aws_* classes", {
9595
})
9696

9797
tar_test("package detection", {
98+
skip_cran()
9899
target <- tar_target(x, "x_value", format = "feather", repository = "aws")
99100
out <- sort(store_get_packages(target$store))
100101
exp <- sort(c("paws", "arrow"))

tests/testthat/test-class_gcp.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ tar_test("store_gcp_version()", {
3333
})
3434

3535
tar_test("package detection", {
36+
skip_cran()
3637
target <- tar_target(x, "x_value", format = "feather", repository = "gcp")
3738
out <- sort(store_get_packages(target$store))
3839
exp <- sort(c("googleCloudStorageR", "arrow"))

tests/testthat/test-class_runtime.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ tar_test("file_info_exist", {
8989
expect_silent(runtime_validate(x))
9090
})
9191

92+
tar_test("nanonext", {
93+
x <- runtime_new()
94+
expect_null(x$nanonext)
95+
x$nanonext <- TRUE
96+
expect_true(x$nanonext)
97+
expect_silent(runtime_validate(x))
98+
})
99+
92100
tar_test("validate null fields", {
93101
x <- runtime_new()
94102
expect_silent(runtime_validate(x))

tests/testthat/test-utils_time.R

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
test_that("time_seconds_local()", {
2+
tar_runtime$nanonext <- NULL
3+
for (i in seq_len(4)) {
4+
out <- time_seconds_local()
5+
expect_true(is.numeric(out))
6+
expect_false(anyNA(out))
7+
expect_equal(length(out), 1L)
8+
}
9+
expect_equal(2 * 2, 4)
10+
})

0 commit comments

Comments
 (0)