Skip to content

Commit

Permalink
clean up vignette and add test for building r packages
Browse files Browse the repository at this point in the history
  • Loading branch information
dewittpe committed Sep 19, 2024
1 parent b932be1 commit 69bd69a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
29 changes: 29 additions & 0 deletions tests/test-build_r_pkg.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
library(REDCapExporter)
temppath <- tempdir()
build_r_data_package(
x = avs_raw_core,
path = temppath,
author_roles = list(dewittp = c("cre", "aut")),
)

x <- fs::dir_tree(temppath)
x <- substr(x, start = nchar(temppath) + 1, stop = nchar(x))
x <- as.character(x)

stopifnot(
identical(
x,
c("rcd14465", "rcd14465/DESCRIPTION", "rcd14465/LICENSE", "rcd14465/NAMESPACE",
"rcd14465/R", "rcd14465/R/datasets.R", "rcd14465/data", "rcd14465/data/metadata.rda",
"rcd14465/data/project.rda", "rcd14465/data/record.rda", "rcd14465/data/user.rda",
"rcd14465/inst", "rcd14465/inst/raw-data", "rcd14465/inst/raw-data/metadata.rds",
"rcd14465/inst/raw-data/project.rds", "rcd14465/inst/raw-data/record.rds",
"rcd14465/inst/raw-data/user.rds", "rcd14465/man", "rcd14465/man/metadata.Rd",
"rcd14465/man/project.Rd", "rcd14465/man/record.Rd", "rcd14465/man/user.Rd")
)
)

stopifnot(
packageDescription(pkg = "rcd14465", lib.loc = temppath)$Package == "rcd14465",
grepl("\\d{4}\\.\\d{2}\\.\\d{2}\\.\\d{2}\\.\\d{2}", packageDescription(pkg = "rcd14465", lib.loc = temppath)$Version)
)
3 changes: 1 addition & 2 deletions vignette-spinners/redcap2package.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ temppath <- tempdir()
build_r_data_package(
x = avs_raw_core,
path = temppath,
author_roles = list(dewittp = c("cre", "aut")),
class = "data.frame" # format data as data.frames
author_roles = list(dewittp = c("cre", "aut"))
)

#'
Expand Down
3 changes: 1 addition & 2 deletions vignettes/redcap2package.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ temppath <- tempdir()
build_r_data_package(
x = avs_raw_core,
path = temppath,
author_roles = list(dewittp = c("cre", "aut")),
class = "data.frame" # format data as data.frames
author_roles = list(dewittp = c("cre", "aut"))
)
```

Expand Down

0 comments on commit 69bd69a

Please sign in to comment.