From 0e1cbf4cd16c6124836041692cccc5f19a1e40f2 Mon Sep 17 00:00:00 2001 From: Vedha Viyash Date: Fri, 4 Aug 2023 11:25:15 +0530 Subject: [PATCH] fix: also install and update the package dependencies --- README.md | 2 +- _internal/utils/sourceme.R | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1c0ce5790..8ca78937b 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Running the `restore_and_run("APP_NAME")` will run the `APP_NAME` by restoring t source("https://raw.github.com/insightsengineering/teal.gallery/main/_internal/utils/sourceme.R") # Run the basic-teal app after installing all the stable versions of teal dependencies from https://insightsengineering.r-universe.dev -restore_and_run("basic-teal", package_repo = "https://pharmaverse.r-universe.dev") +restore_and_run("basic-teal", package_repo = "https://insightsengineering.r-universe.dev") # Run the basic-teal app after installing all the beta versions of teal dependencies from https://pharmaverse.r-universe.dev restore_and_run("basic-teal", package_repo = "https://pharmaverse.r-universe.dev") diff --git a/_internal/utils/sourceme.R b/_internal/utils/sourceme.R index 0e6a10f41..5db971ff7 100644 --- a/_internal/utils/sourceme.R +++ b/_internal/utils/sourceme.R @@ -62,14 +62,18 @@ restore_and_run <- function( #' @param app_directory The directory path of the Shiny app. #' @param ... Additional arguments passed to `shiny::runApp()`. load_and_run_app <- function(app_directory, package_repo, ...) { - install.packages( - renv::dependencies(app_directory)$Package, - repos = c( - Pharmaverse = package_repo, - CRAN = "https://cloud.r-project.org", - BioC = BiocManager::repositories() + renv::dependencies()$Package |> + tools::package_dependencies() |> + unlist() |> + unname() |> + unique() |> + install.packages( + repos = c( + Pharmaverse = package_repo, + CRAN = "https://cloud.r-project.org", + BioC = BiocManager::repositories() + ) ) - ) shiny::runApp(app_directory, ...) }