Skip to content

Commit

Permalink
fix: also install and update the package dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Vedha Viyash authored and Vedha Viyash committed Aug 4, 2023
1 parent 3fe4510 commit 0e1cbf4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
18 changes: 11 additions & 7 deletions _internal/utils/sourceme.R
Original file line number Diff line number Diff line change
Expand Up @@ -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, ...)
}

Expand Down

0 comments on commit 0e1cbf4

Please sign in to comment.