-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from metrumresearchgroup/file-delete
Add fileDelete function
- Loading branch information
Showing
6 changed files
with
60 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,24 @@ | ||
#' Remove file from QClog | ||
#' | ||
#' @description | ||
#' This function facilitates deleting a file from the QClog.csv file. | ||
#' When run, all rows associated with the file will be deleted and | ||
#' removed from the QC log. | ||
#' | ||
#' @param .filepath current file path of file to be removed | ||
#' | ||
#' @export | ||
logRemove <- function(.filepath) { | ||
|
||
qclog <- logRead() | ||
qclog2 <- qclog[qclog$file != .filepath, ] | ||
|
||
# Check current file path exists | ||
if(nrow(qclog) == nrow(qclog2)) { | ||
stop(paste0(.filepath, " does not exist in QClog.csv")) | ||
} | ||
|
||
cli::cli_alert_info(glue::glue("Deleted '{.filepath}' from QClog.csv")) | ||
|
||
logWrite(qclog2, file = "QClog.csv") | ||
} |
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 |
---|---|---|
|
@@ -37,4 +37,5 @@ reference: | |
- svnLog | ||
- svnExport | ||
- demoRepo | ||
- logRemove | ||
- repoHistory |
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,16 @@ | ||
with_demoRepo({ | ||
|
||
testthat::test_that("logRemove removes the file from the QClog", { | ||
|
||
qclog <- logRead() | ||
expect_true(nrow(qclog[qclog$file == "script/data-assembly.R",]) > 0) | ||
|
||
logRemove("script/data-assembly.R") | ||
qclog2 <- logRead() | ||
|
||
expect_true(nrow(qclog2[qclog2$file == "script/data-assembly.R",]) == 0) | ||
}) | ||
}) | ||
|
||
|
||
|