-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
078e95d
commit 341b6f6
Showing
18 changed files
with
214 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#' @title Check if target metadata exists. | ||
#' @export | ||
#' @description Check if the target metadata file `_targets/meta/meta` | ||
#' exists for the current project. | ||
#' @details To learn more about local storage in `targets`, visit | ||
#' <https://books.ropensci.org/targets/files.html#internal-files>. | ||
#' @return Logical of length 1, whether the current project's metadata exists. | ||
#' @examples | ||
#' tar_exist_meta() | ||
tar_exist_meta <- function() { | ||
file.exists(path_meta()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#' @title Check if local output data exists for one or more targets. | ||
#' @export | ||
#' @description Check if the local data files exist in | ||
#' `_targets/objects/` for one or more targets. | ||
#' @details To learn more about local storage in `targets`, visit | ||
#' <https://books.ropensci.org/targets/files.html#internal-files>. | ||
#' @return Logical of length `length(names)`, whether | ||
#' each given target has an existing file in `_targets/objects/` | ||
#' for the current project. | ||
#' @param names Character vector of target names. | ||
#' @examples | ||
#' tar_exist_objects(c("target1", "target2")) | ||
tar_exist_objects <- function(names) { | ||
assert_chr(names, "names must be a character vector.") | ||
file.exists(path_objects(names)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#' @title Check if process metadata exists. | ||
#' @export | ||
#' @description Check if the process metadata file `_targets/meta/process` | ||
#' exists for the current project. | ||
#' @details To learn more about local storage in `targets`, visit | ||
#' <https://books.ropensci.org/targets/files.html#internal-files>. | ||
#' @return Logical of length 1, whether the current project's metadata exists. | ||
#' @examples | ||
#' tar_exist_process() | ||
tar_exist_process <- function() { | ||
file.exists(path_process()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#' @title Check if progress metadata exists. | ||
#' @export | ||
#' @description Check if the progress metadata file `_targets/meta/progress` | ||
#' exists for the current project. | ||
#' @details To learn more about local storage in `targets`, visit | ||
#' <https://books.ropensci.org/targets/files.html#internal-files>. | ||
#' @return Logical of length 1, whether the current project's metadata exists. | ||
#' @examples | ||
#' tar_exist_progress() | ||
tar_exist_progress <- function() { | ||
file.exists(path_progress()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#' @title Check if the target script exists. | ||
#' @export | ||
#' @description Check if the `_targets.R` file of the current project exists. | ||
#' exists for the current project. | ||
#' @return Logical of length 1, whether the current project's metadata exists. | ||
#' @examples | ||
#' tar_exist_script() | ||
tar_exist_script <- function() { | ||
file.exists(path_script()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
tar_test("tar_exist_meta()", { | ||
expect_false(tar_exist_meta()) | ||
dir_create(dirname(path_meta())) | ||
file.create(path_meta()) | ||
expect_true(tar_exist_meta()) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
tar_test("tar_exist_objects()", { | ||
dir_create(dirname(path_objects("x"))) | ||
file.create(path_objects("x")) | ||
expect_equal(tar_exist_objects(c("y", "x")), c(FALSE, TRUE)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
tar_test("tar_exist_process()", { | ||
expect_false(tar_exist_process()) | ||
dir_create(dirname(path_process())) | ||
file.create(path_process()) | ||
expect_true(tar_exist_process()) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
tar_test("tar_exist_progress()", { | ||
expect_false(tar_exist_progress()) | ||
dir_create(dirname(path_progress())) | ||
file.create(path_progress()) | ||
expect_true(tar_exist_progress()) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
tar_test("tar_exist_script()", { | ||
expect_false(tar_exist_script()) | ||
tar_script() | ||
expect_true(tar_exist_script()) | ||
}) |