Skip to content
Open
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
45 changes: 45 additions & 0 deletions R/install.software.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#' Install packages listed in \verb{SOFTWARE.bib}
#'
#' The information on packages and their versions contained in
#' \verb{SOFTWARE.bib} is taken to install them. If the same precise
#' versions are requested, they are installed from the individual github
#' repositories using the stored hash reference. When the latest version of the
#' listed packages is requested instead, they are downloaded from
#' r-universe.dev, including those packages available in CRAN.
#'
#' @param latest Whether to install the recorded packages versions. Logical, TRUE.
#' @param ... Extra arguments to be pass on to install_github.
#'
#' @return TRUE invisibly if succesfull
#'
#' @name install.software
#' @rdname install.software
#'
#' @seealso [TAF::check.software] [devtools::install_github]
#' @examples
#' \dontrun{
#' install.software()
#' install.software(latest=TRUE)
#' }
#'
#' @importFrom remotes install_github
#'
#' @export

install.software <- function(latest=FALSE, ...) {

# GET list of packages in SOFTWARE.bib
sources <- taf.sources('software')

# INSTALL latest from r-universe
if(latest) {
sapply(sources, function(x) install.packages(x$key,
repos=paste0("https://", strsplit(x$source, '/')[[1]][1],
".r-universe.dev")))
# or exact version from github
} else {
sapply(sources, function(x) install_github(x$source, ...))
}

invisible(TRUE)
}