Skip to content

Commit 1761581

Browse files
Always ignore case, search recursively, include hidden files. Expand exclude_dirs to all files and substract these from the scheduled files, otherwise, we might fail to exclude some sub-directories
1 parent e043ecf commit 1761581

File tree

5 files changed

+40
-18
lines changed

5 files changed

+40
-18
lines changed

R/ui-styling.R

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,42 +110,42 @@ prettify_pkg <- function(transformers,
110110
include_roxygen_examples,
111111
base_indention,
112112
dry) {
113-
filetype <- set_and_assert_arg_filetype(filetype)
113+
filetype_ <- set_and_assert_arg_filetype(filetype)
114114
r_files <- rprofile_files <- vignette_files <- readme <- NULL
115-
exclude_files <- set_arg_paths(exclude_files)
116-
exclude_dirs <- set_arg_paths(exclude_dirs)
117-
without_excluded <- purrr::partial(setdiff, y = exclude_dirs)
118-
if ("\\.r" %in% filetype) {
115+
exclude_files <- c(
116+
set_arg_paths(exclude_files),
117+
dir_without_.(exclude_dirs, pattern = map_filetype_to_pattern(filetype))
118+
)
119+
if ("\\.r" %in% filetype_) {
119120
r_files <- dir_without_.(
120-
path = without_excluded(c("R", "tests", "data-raw", "demo")),
121+
path = c("R", "tests", "data-raw", "demo"),
121122
pattern = "\\.r$"
122123
)
123124
}
124125

125-
if ("\\.rprofile" %in% filetype) {
126+
if ("\\.rprofile" %in% filetype_) {
126127
rprofile_files <- dir_without_.(
127-
path = without_excluded("."), pattern = "^\\.rprofile$"
128+
path = ".", pattern = "^\\.rprofile$"
128129
)
129130
}
130-
if ("\\.rmd" %in% filetype) {
131+
if ("\\.rmd" %in% filetype_) {
131132
vignette_files <- dir_without_.(
132-
path = without_excluded("vignettes"), pattern = "\\.rmd$"
133+
path = "vignettes", pattern = "\\.rmd$"
133134
)
134135
readme <- dir_without_.(
135136
path = ".",
136-
pattern = without_excluded("^readme\\.rmd$")
137+
pattern = "^readme\\.rmd$"
137138
)
138139
}
139140

140-
if ("\\.rnw" %in% filetype) {
141+
if ("\\.rnw" %in% filetype_) {
141142
vignette_files <- append(
142143
vignette_files,
143144
dir_without_.(
144-
path = without_excluded("vignettes"), pattern = "\\.rnw$"
145+
path = "vignettes", pattern = "\\.rnw$"
145146
)
146147
)
147148
}
148-
149149
files <- setdiff(
150150
c(r_files, rprofile_files, vignette_files, readme),
151151
exclude_files

R/utils-files.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@ map_filetype_to_pattern <- function(filetype) {
2727
paste0("(", paste(set_and_assert_arg_filetype(filetype), collapse = "|"), ")$")
2828
}
2929

30-
#' `dir()`, but without dot-prefix
30+
#' `dir()`, but without dot-prefix and different defaults
3131
#'
3232
#' When using `dir()`, you can set `full.names = FALSE`, but then you can only
3333
#' pass a character vector of length one as `path` to not loose the information
3434
#' about where the files are. This function solves that case. It's needed when
3535
#' one wants to standardize paths to use set operations on them, i.e. when the
3636
#' user supplied input does not have a dot prefix. See 'Examples'.
37+
#'
38+
#' For different defaults, see `dir_without_._one`.
3739
#' @param path A path.
3840
#' @param ... Passed to [base::dir()].
3941
#' @seealso set_and_assert_arg_paths
@@ -45,6 +47,9 @@ dir_without_. <- function(path, ...) {
4547
unlist()
4648
}
4749

50+
#' `dir()`, but with full names, ignored case, and included hidden files and
51+
#' recursive.
52+
#' @keywords internal
4853
dir_without_._one <- function(path, ...) {
4954
relative <- dir(
5055
path = path,

man/combine_children.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/dir_without_..Rd

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/dir_without_._one.Rd

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)