Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
77 additions
and
3 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,20 @@ | ||
#' Ignore specific files by git and R build. | ||
#' | ||
#' @param file \code{character} File to ignore. | ||
#' @param path \code{character} Path to the file. | ||
#' | ||
#' @return invisibly returns 0. | ||
#' @export | ||
#' | ||
#' @examples | ||
#' use_ignore("foo", ".") | ||
use_ignore <- function(file = NULL, path = NULL){ | ||
if (is.null(file)) { | ||
message("No file name provided to ignore.") | ||
invisible(0) | ||
} | ||
proj_path <- usethis::proj_get() | ||
usethis::use_build_ignore(files = file.path(path,file), escape = TRUE) | ||
usethis::use_git_ignore(ignores = file, directory = path) | ||
invisible(0) | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,17 @@ | ||
context("ignore") | ||
|
||
test_that("use_ignore works", { | ||
file <- system.file("extdata", "tests", "subsetCars.Rmd", | ||
package = "DataPackageR" | ||
) | ||
expect_null( | ||
datapackage_skeleton( | ||
name = "subsetCars", | ||
path = tempdir(), | ||
code_files = c(file), | ||
force = TRUE, | ||
r_object_names = c("cars_over_20") | ||
) | ||
) | ||
expect_output(use_ignore(file = "mydata.csv",path = "inst/extdata"),"Adding 'mydata.csv' to 'inst/extdata/\\.gitignore'|Adding '\\^inst/extdata/mydata\\\\.csv\\$' to '\\.Rbuildignore'") | ||
}) |
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