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

Added save_all() helper function for saving all docs in IDE session. #1865

Merged
merged 1 commit into from
Sep 10, 2018
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# devtools 1.13.3.9000

* `save_all()` helper function wraps `rstudioapi::documentSaveAll()` calls (#1850, @amundsenjunior).

* `check()` now allows users to run without `--timings` (#1655)

* devtools now depends on roxygen2 6.1.0: this considerably simplifies
Expand Down
4 changes: 1 addition & 3 deletions R/build-readme.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
build_readme <- function(path = ".", quiet = TRUE, ...) {
check_suggested("rmarkdown")

if (rstudioapi::hasFun("documentSaveAll")) {
rstudioapi::documentSaveAll()
}
save_all()

pkg <- as.package(path)

Expand Down
4 changes: 1 addition & 3 deletions R/build-site.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
build_site <- function(path = ".", quiet = TRUE, ...) {
check_suggested("pkgdown")

if (rstudioapi::hasFun("documentSaveAll")) {
rstudioapi::documentSaveAll()
}
save_all()

pkg <- as.package(path)

Expand Down
4 changes: 1 addition & 3 deletions R/check.r
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ check <- function(pkg = ".",
pkg <- as.package(pkg)
withr::local_options(list(warn = 1))

if (rstudioapi::hasFun("documentSaveAll")) {
rstudioapi::documentSaveAll()
}
save_all()

if (!missing(cleanup)) {
warning("`cleanup` is deprecated", call. = FALSE)
Expand Down
4 changes: 1 addition & 3 deletions R/document.r
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ document <- function(pkg = ".", roclets = NULL) {
pkg <- as.package(pkg)
message("Updating ", pkg$package, " documentation")

if (rstudioapi::hasFun("documentSaveAll")) {
rstudioapi::documentSaveAll()
}
save_all()

withr::with_envvar(r_env_vars(), roxygen2::roxygenise(pkg$path, roclets))

Expand Down
4 changes: 1 addition & 3 deletions R/pkgbuild.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
#' @export
build <- function(path = ".", dest_path = NULL, binary = FALSE, vignettes = TRUE,
manual = FALSE, args = NULL, quiet = FALSE, ...) {
if (rstudioapi::hasFun("documentSaveAll")) {
rstudioapi::documentSaveAll()
}
save_all()
pkgbuild::build(path = path, dest_path = dest_path, binary = binary,
vignettes = vignettes, manual = manual, args = args, quiet = quiet, ...)
}
Expand Down
4 changes: 1 addition & 3 deletions R/pkgload.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
#' @export
load_all <- function(path = ".", reset = TRUE, recompile = FALSE,
export_all = TRUE, helpers = TRUE, quiet = FALSE, ...) {
if (rstudioapi::hasFun("documentSaveAll")) {
rstudioapi::documentSaveAll()
}
save_all()

pkgload::load_all(path = path, reset = reset, recompile = recompile,
export_all = export_all, helpers = helpers, quiet = quiet, ...)
Expand Down
13 changes: 13 additions & 0 deletions R/save-all.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#' Save all documents in an active IDE session.
#'
#' Helper function wrapping IDE-specific calls to save all documents in the
#' active session. In this form, callers of \code{save_all()} don't need to
#' execute any IDE-specific code. This function can be extened to include
#' other IDE implementations of their equivalent
#' \code{rstudioapi::documentSaveAll()} methods.
#' @return NULL
save_all <- function() {
if (rstudioapi::hasFun("documentSaveAll")) {
rstudioapi::documentSaveAll()
}
}
8 changes: 2 additions & 6 deletions R/test.r
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
test <- function(pkg = ".", filter = NULL, ...) {
check_suggested("testthat")

if (rstudioapi::hasFun("documentSaveAll")) {
rstudioapi::documentSaveAll()
}
save_all()

pkg <- as.package(pkg)

Expand Down Expand Up @@ -83,9 +81,7 @@ test_coverage <- function(pkg = ".", show_report = interactive(), ...) {

check_suggested("covr")

if (rstudioapi::hasFun("documentSaveAll")) {
rstudioapi::documentSaveAll()
}
save_all()

withr::with_envvar(r_env_vars(),
coverage <- covr::package_coverage(pkg$path, ...)
Expand Down
15 changes: 15 additions & 0 deletions man/save_all.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.