-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Author changes in description file * Dev version bump * update compare for same number of dataobjects * Update CONTRIBUTING.md with Git workflow guidlines and CI reminder. (#87) Co-authored-by: Jason Taylor jmtaylor@fredhutch.org * Vignette edits (#92) * text edits to vignettes * match casing for vignette names * rm non-rmd files in vignettes, add .gitignore to vignettes * add style pointers for vignettes to contributing * alter valid name expression to allow for different names in each set * add tests for .compare_digests * Usethis patch (#74) * Patch to address #73 * bump version, update travis, test locally, rerun codemeta. #73 * imports for withr for #73 * update news. #73 * refactor logic of .compare_digests, fix typo package_build help * add test for .compare_digests refactor * Add maintainer email and role. * improve test coverage * new_digest zero length check in .check_digests not needed, removed * specify serialization for backward compatibility (#94) * specify serialization for backward compatibility * removed whitespace edits Co-authored-by: Jason Taylor <jmtaylor@fredhutch.org> * add condition for checking for removed data in digest * fix list subsetting, update tests * add back deleted dataversion.R Co-authored-by: William Fulp <wfulp@fredhutch.org> Co-authored-by: jmtaylor-fhcrc <42221209+jmtaylor-fhcrc@users.noreply.github.com> Co-authored-by: Jason Taylor <jmtaylor@fredhutch.org> Co-authored-by: Greg Finak <greg.finak@gmail.com> Co-authored-by: Jimmy Fulp <WilliamJFulp@gmail.com>
- Loading branch information
1 parent
8c443ca
commit 1bfcf63
Showing
22 changed files
with
338 additions
and
2,573 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
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
File renamed without changes.
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
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,61 @@ | ||
test_that("data object can be renamed", { | ||
|
||
addData <- function(dataset, pname){ | ||
fil <- sprintf("data(%s, envir=environment())", dataset) | ||
writeLines(fil, file.path(tempdir(), sprintf("%s/data-raw/%s.R", pname, dataset))) | ||
|
||
yml <- yml_add_files(file.path(tempdir(), pname), c(sprintf("%s.R", dataset))) | ||
yml <- yml_add_objects(yml, dataset) | ||
yml_write(yml) | ||
|
||
package_build(file.path(tempdir(), pname)) | ||
} | ||
|
||
changeName <- function(old_dataset_name, new_dataset_name, pname){ | ||
process_path <- file.path(tempdir(), sprintf("%s/data-raw/%s.R", pname, old_dataset_name)) | ||
fil <- c(readLines(process_path), sprintf("%s <- %s", new_dataset_name, old_dataset_name)) | ||
writeLines(fil, process_path) | ||
|
||
yml <- yml_remove_objects(file.path(tempdir(), pname), old_dataset_name) | ||
yml <- yml_add_objects(yml, new_dataset_name) | ||
yml_write(yml) | ||
|
||
package_build(file.path(tempdir(), pname)) | ||
} | ||
|
||
removeName <- function(dataset_name, script, pname){ | ||
process_path <- file.path(tempdir(), sprintf("%s/data-raw/%s", pname, script)) | ||
fil <- gsub(paste0("^", dataset_name, ".+$"), "", readLines(process_path)) | ||
writeLines(fil, process_path) | ||
|
||
yml <- yml_remove_objects(file.path(tempdir(), pname), dataset_name) | ||
yml_write(yml) | ||
|
||
package_build(file.path(tempdir(), pname)) | ||
} | ||
|
||
## test change when one object is present | ||
pname <- "nameChangeTest1" | ||
datapackage_skeleton(pname, tempdir(), force = TRUE) | ||
addData("mtcars", pname) | ||
expect_error(changeName("mtcars", "mtcars2", pname), NA) | ||
expect_error(removeName("mtcars2", "mtcars.R", pname), "exiting") | ||
|
||
## test change when two objects are present | ||
pname <- "nameChangeTest2" | ||
datapackage_skeleton(pname, tempdir(), force = TRUE) | ||
addData("mtcars", pname) | ||
addData("iris", pname) | ||
expect_error(changeName("mtcars", "mtcars2", pname), NA) | ||
expect_error(removeName("mtcars2", "mtcars.R", pname), NA) | ||
|
||
## test change when more than 2 objects are present | ||
pname <- "nameChangeTest3" | ||
datapackage_skeleton(pname, tempdir(), force = TRUE) | ||
addData("mtcars", pname) | ||
addData("iris", pname) | ||
addData("ToothGrowth", pname) | ||
expect_error(changeName("mtcars", "mtcars2", pname), NA) | ||
expect_error(removeName("mtcars2", "mtcars.R", pname), NA) | ||
|
||
}) |
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,3 @@ | ||
*.R | ||
*.md | ||
*.html |
Oops, something went wrong.