Skip to content

Instantly share code, notes, and snippets.

@franzbischoff
Created March 4, 2020 21:19
Show Gist options
  • Save franzbischoff/08d95547cfc6ad72568496c654735fc7 to your computer and use it in GitHub Desktop.
Save franzbischoff/08d95547cfc6ad72568496c654735fc7 to your computer and use it in GitHub Desktop.
Check which files are ignored and which will stay in your R package using .Rbuildignore
check_buildignore <- function() {
patterns <- readLines(".Rbuildignore")
hits <- list()
for (pat in patterns) {
hit <- dir(
full.names = FALSE, recursive = TRUE,
all.files = TRUE, include.dirs = TRUE, no.. = TRUE
)[grepl(
pat,
dir(
full.names = FALSE, recursive = TRUE,
all.files = TRUE, include.dirs = TRUE, no.. = TRUE
)
)]
hits[[pat]] <- hit
}
root <- dir(
pattern = ".*",
full.names = FALSE, recursive = FALSE,
all.files = TRUE, include.dirs = TRUE, no.. = TRUE
)
pass <- root[!(root %in% unique(unlist(hits)))]
return(list(ignored = hits, pass = pass))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment