Skip to content

Commit

Permalink
Allow non-interactive package updates
Browse files Browse the repository at this point in the history
If pkgs is TRUE, update all packages without prompting
  • Loading branch information
pkq committed Nov 8, 2016
1 parent ba7a5a4 commit ab514c1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
@@ -1,4 +1,6 @@
# devtools 1.12.0.9000
* `update_packages()` allows for override of interactive prompt (#1260, @pkq).

* Bugfix for installation of dependencies in CRAN-like repositories such as
those created by drat (@jimhester, #1243, #1339).

Expand Down
10 changes: 7 additions & 3 deletions R/deps.R
Expand Up @@ -368,8 +368,9 @@ standardise_dep <- function(x) {
#' Works similarly to \code{install.packages()} but doesn't install packages
#' that are already installed, and also upgrades out dated dependencies.
#'
#' @param pkgs Character vector of packages to update. If \code{NULL} all
#' installed packages are updated.
#' @param pkgs Character vector of packages to update. IF \code{TRUE} all
#' installed packages are updated. If \code{NULL} user is prompted to
#' confirm update of all installed packages.
#' @inheritParams package_deps
#' @seealso \code{\link{package_deps}} to see which packages are out of date/
#' missing.
Expand All @@ -383,7 +384,10 @@ update_packages <- function(pkgs = NULL, dependencies = NA,
repos = getOption("repos"),
type = getOption("pkgType")) {

if (is.null(pkgs)) {
if (isTRUE(pkgs)) {
pkgs <- installed.packages()[, "Package"]
}
else if (is.null(pkgs)) {
if (!yesno("Are you sure you want to update all installed packages?")) {
pkgs <- installed.packages()[, "Package"]
} else {
Expand Down
4 changes: 2 additions & 2 deletions man/install_version.Rd

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

5 changes: 3 additions & 2 deletions man/update_packages.Rd

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

0 comments on commit ab514c1

Please sign in to comment.