diff --git a/NEWS.md b/NEWS.md index a5f62dc..944bf46 100644 --- a/NEWS.md +++ b/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) diff --git a/R/ignore.R b/R/ignore.R index 2887cec..e6c30f0 100644 --- a/R/ignore.R +++ b/R/ignore.R @@ -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) diff --git a/R/processData.R b/R/processData.R index 435ff51..383d782 100644 --- a/R/processData.R +++ b/R/processData.R @@ -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) { @@ -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) { diff --git a/inst/extdata/tests/rfileTest.R b/inst/extdata/tests/rfileTest.R index 75cd0c2..bd81d53 100644 --- a/inst/extdata/tests/rfileTest.R +++ b/inst/extdata/tests/rfileTest.R @@ -2,5 +2,6 @@ #' title: Sample report from R script #' author: Greg Finak #' date: August 1, 2018 +#' output: pdf_document #' --- data <- runif(100) diff --git a/tests/testthat/test-ignore.R b/tests/testthat/test-ignore.R index 791f04b..9834ee2 100644 --- a/tests/testthat/test-ignore.R +++ b/tests/testthat/test-ignore.R @@ -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.") }) diff --git a/tests/testthat/test-r-processing.R b/tests/testthat/test-r-processing.R index f8b0067..631defd 100644 --- a/tests/testthat/test-r-processing.R +++ b/tests/testthat/test-r-processing.R @@ -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 diff --git a/tests/testthat/test-use_raw_data.R b/tests/testthat/test-use_raw_data.R index 25ef664..00a434c 100644 --- a/tests/testthat/test-use_raw_data.R +++ b/tests/testthat/test-use_raw_data.R @@ -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)) })