Skip to content

Commit

Permalink
Updates for pkginstall reorganization
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborcsardi committed Mar 14, 2018
1 parent c6af6ce commit a93884c
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 27 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ Imports:
cli (>= 1.0.0),
crayon (>= 1.3.4),
glue (>= 1.2.0),
pkgdepends (>= 0.0.0.9000),
pkginstall (>= 0.0.0.9000),
pkgdepends (>= 0.0.0.9002),
pkginstall (>= 0.0.0.9001),
rematch2 (>= 2.0.0),
rex (>= 1.1.2),
tibble (>= 1.3.4)
Remotes:
r-lib/async,
r-lib/pkgdepends,
r-lib/pkginstall
r-lib/pkginstall@reorganize
Roxygen: list(markdown = TRUE)
Depends:
R (>= 3.1)
Expand Down
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ importFrom(crayon,bold)
importFrom(crayon,green)
importFrom(glue,glue_data)
importFrom(pkgdepends,remotes)
importFrom(pkginstall,install_packages)
importFrom(pkginstall,install_package_plan)
importFrom(stats,setNames)
importFrom(tibble,tibble)
importFrom(utils,packageDescription)
Expand Down
28 changes: 12 additions & 16 deletions R/package.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#' Install a package
#'
#' Install a package and it's dependencies.
#' @param pkg A package specification. See [pkgdepends::remotes] for details.
#' @param upgrade whether to upgrade already installed packages to the
#' latest available version
#' @inheritParams pkginstall::install_packages
#' @param pkg Package names or remote package specifications to install.
#' See [pkgdepends::remotes] for details about remote package
#' specifications.
#' @param lib Package library to install the packages to.
#' @param upgrade Whether to upgrade already installed packages to the
#' latest available version.
#' @param num_workers Number of worker processes to use.
#' @importFrom pkgdepends remotes
#' @importFrom pkginstall install_packages
#' @importFrom pkginstall install_package_plan
#' @importFrom crayon blue
#' @export
pkg_install <- function(pkg, lib = .libPaths()[[1L]], upgrade = FALSE,
Expand Down Expand Up @@ -37,6 +40,7 @@ pkg_install <- function(pkg, lib = .libPaths()[[1L]], upgrade = FALSE,
and {dir$num_deps[i]} dependencies already installed")
}
}
invisible(plan)

} else {
# Remove already installed dependencies from the plan
Expand All @@ -45,22 +49,14 @@ pkg_install <- function(pkg, lib = .libPaths()[[1L]], upgrade = FALSE,
lapply(needs_install$dependencies, setdiff, y = installed)

# Install what is left
inst_stat <- install_packages(
needs_install$file, lib = lib, plan = needs_install,
num_workers = num_workers)

if (is_verbose()) print(inst_stat)

inst_lib <- match(plan$file, names(inst_stat))
plan$installed[match(names(inst_stat), plan$file)] <- unlist(inst_stat)
install_package_plan(
plan = needs_install, lib = lib, num_workers = num_workers)
}

invisible(plan)
}

#' Install a local development package
#' @param path to the local package
#' @inheritParams pkginstall::install_packages
#' @inheritParams pkg_install
#' @importFrom pkgdepends remotes
#' @export
local_pkg_install <- function(path = ".", lib = .libPaths()[[1L]], num_workers = 1L) {
Expand Down
4 changes: 2 additions & 2 deletions man/local_pkg_install.Rd

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

12 changes: 7 additions & 5 deletions man/pkg_install.Rd

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

0 comments on commit a93884c

Please sign in to comment.