Skip to content

Commit

Permalink
tests and fix #55
Browse files Browse the repository at this point in the history
tests and a bugfix for #48
udpate NEWS.md
  • Loading branch information
gfinak committed Sep 28, 2018
1 parent 60ef0cc commit ebf0c34
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 5 deletions.
7 changes: 5 additions & 2 deletions NEWS.md
@@ -1,14 +1,17 @@
# DataPackageR 0.15.3.9000
### Features and enhancements
* Reduce the console output from logging. (ropensci/DataPackageR/issues/50)
* Create a new logger that logs at different thresholds to console and to file (ropensci/DataPackageR/issues/50)
* Default on build is not to install.
* Hide console output from Rmd render.
* Nicer messages describing data sets that are created (ropensci/DataPackageR/issues/51)
* Write deleted, changed, and added data objects to the NEWS file automatically.
* Fix the documentation for datapackager_object_read() and "Migrating old packages".
* code argument no longer required for construct_yml_config
* Add option to overwrite (or not) via use_processing_script. Provide warning.
* Add use_ignore() to ignore files and data sets in .Rbuildignore and .gitignore and added ignore argument to use_raw_dataset().
### Bug fixes
* code argument no longer required for construct_yml_config
* Fix the documentation for datapackager_object_read() and "Migrating old packages".
* Copy over vignettes generated as pdfs into the package inst/doc

# DataPackageR 0.15.3
* conditional tests when pandoc is missing (ropensci/DataPackager/issues/46)
Expand Down
2 changes: 1 addition & 1 deletion R/ignore.R
Expand Up @@ -11,7 +11,7 @@
use_ignore <- function(file = NULL, path = NULL){
if (is.null(file)) {
message("No file name provided to ignore.")
invisible(0)
return(invisible(0))
}
proj_path <- usethis::proj_get()
usethis::use_build_ignore(files = file.path(path,file), escape = TRUE)
Expand Down
21 changes: 21 additions & 0 deletions R/processData.R
Expand Up @@ -591,6 +591,13 @@ DataPackageR <- function(arg = NULL, deps = TRUE) {
full.names = TRUE,
recursive = FALSE
)
pdffiles_for_vignettes <-
list.files(
path = file.path(dir, "inst/extdata/Logfiles"),
pattern = "pdf$",
full.names = TRUE,
recursive = FALSE
)
purrr::map(
htmlfiles_for_vignettes,
function(x) {
Expand All @@ -604,6 +611,20 @@ DataPackageR <- function(arg = NULL, deps = TRUE) {
)
}
)

purrr::map(
pdffiles_for_vignettes,
function(x) {
file.copy(x,
file.path(
dir,
"inst/doc",
basename(x)
),
overwrite = TRUE
)
}
)
utils::capture.output(purrr::map(
rmdfiles_for_vignettes,
function(x) {
Expand Down
1 change: 1 addition & 0 deletions inst/extdata/tests/rfileTest.R
Expand Up @@ -2,5 +2,6 @@
#' title: Sample report from R script
#' author: Greg Finak
#' date: August 1, 2018
#' output: pdf_document
#' ---
data <- runif(100)
1 change: 1 addition & 0 deletions tests/testthat/test-ignore.R
Expand Up @@ -14,4 +14,5 @@ test_that("use_ignore works", {
)
)
expect_output(use_ignore(file = "mydata.csv",path = "inst/extdata"),"Adding 'mydata.csv' to 'inst/extdata/\\.gitignore'|Adding '\\^inst/extdata/mydata\\\\.csv\\$' to '\\.Rbuildignore'")
expect_message(use_ignore(),"No file name provided to ignore.")
})
2 changes: 1 addition & 1 deletion tests/testthat/test-r-processing.R
Expand Up @@ -21,7 +21,7 @@ test_that("R file processing works and creates vignettes", {
)
v <- vignette(package = "rfiletest")
expect_equal(v$results[, "Item"], "rfileTest")

expect_true(file_test("-f", file.path(tempdir(),"rfiletest","inst","doc","rfileTest.pdf")))
unlink(file.path(tempdir(), "rfiletest"),
recursive = TRUE,
force = TRUE
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-use_raw_data.R
Expand Up @@ -49,7 +49,7 @@ test_that("use_raw_data works as expected", {
))
expect_error(use_raw_dataset())
expect_error(suppressWarnings(use_raw_dataset("foobar")))
expect_true(use_raw_dataset(file.path(tempdir(), "subsetCars20", "R")))
expect_true(use_raw_dataset(file.path(tempdir(), "subsetCars20", "R"), ignore = TRUE))
})


Expand Down

0 comments on commit ebf0c34

Please sign in to comment.