Skip to content

Commit

Permalink
fix install.R
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Apr 15, 2024
1 parent a2d4e68 commit 9a591e7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions install.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
install.packages(c('remotes','jsonlite','yaml'), repos='https://cran.r-project.org/')
package <- jsonlite::read_json(file.path(getwd(), "package.json"))
package <- jsonlite::read_json('./srv/calipseo-shiny/package.json')
invisible(lapply(package$dependencies, function(pkg){
from <- 'cran'
pkg_installer <- remotes::install_version
Expand All @@ -10,7 +9,9 @@ invisible(lapply(package$dependencies, function(pkg){
if(class(pkg_installer)[1] == "try-error") return(NULL)
version <- ""
if(!is.null(pkg$version)) version <- paste0("[",pkg$version,"]")
cat(sprintf("Install package '%s' %s from '%s'\n", pkg$package, version, from), file = stderr())
pkg_args <- pkg[names(pkg)!="from"]
do.call(pkg_installer, pkg_args)
cat(sprintf("Install package '%s' %s from '%s'\n", pkg$package, version, from))
pkg_args <- pkg[!sapply(names(pkg), function(x){x %in% c("from","dependencies")})]
pkg_deps <- NA
if(!is.null(pkg$dependencies)) pkg_deps <- pkg$dependencies
do.call(pkg_installer, c(pkg_args, dependencies = pkg_deps))
}))

0 comments on commit 9a591e7

Please sign in to comment.