Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance of paws build functions #744

Merged
merged 2 commits into from
Jan 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions make.paws/R/sdk_helper.R
Original file line number Diff line number Diff line change
Expand Up @@ -412,26 +412,30 @@ paws_gsub <- function(
cran_r <- lapply(
cran_pkg, \(x) fs::dir_ls(file.path(x, "R"))
)
cran_rd <- lapply(
cran_pkg, \(x) fs::dir_ls(file.path(x, "man"))
)
log_info(
"Removed escaped latex scripts from paws directory."
)

cran_file_gsub <- function(before, after, files) {
for (file in files) {
result <- readLines(file)
result <- gsub(before, after, result)
writeLines(result, file)
found <- grep(before, after, result)
if (length(found) > 0) {
result[found] <- gsub(before, after, result[found])
writeLines(result, file)
}
}
}
for (pkg in cran_pkg) {
cran_file_gsub(before, after, cran_r[[pkg]])
log_info("Successfully update package: %s", pkg)
}
for (file in paws_r) {
result <- readLines(file)
result <- gsub(before, after, result)
writeLines(result, file)
log_info("Successfully update package R scripts: %s", pkg)
cran_file_gsub(before, after, cran_rd[[pkg]])
log_info("Successfully update package rd documentation: %s", pkg)
}
cran_file_gsub(before, after, paws_r)
}

#' @title Rebuild paws documentation
Expand Down
Loading