aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorNaeem Model <me@nmode.ca>2024-05-09 20:34:03 +0000
committerNaeem Model <me@nmode.ca>2024-05-09 20:34:03 +0000
commite467a82539557b156b8d348d6cd0947cdcd1fc44 (patch)
tree624c650b2b5699c556e5bb32f25bc0c9e840d208 /R
parentbd947aec1f45184154fc32a442953a3950e76c76 (diff)
Add Shiny app dependencies add specify entry point
Diffstat (limited to 'R')
-rw-r--r--R/app.R33
1 files changed, 25 insertions, 8 deletions
diff --git a/R/app.R b/R/app.R
index 945f9e4..01f35b4 100644
--- a/R/app.R
+++ b/R/app.R
@@ -4,16 +4,33 @@
#'
#' @export
app <- function() {
+ missing_pkgs <- c()
+ # Check for any missing, required packages.
if (!requireNamespace("shiny", quietly = TRUE)) {
- answer <- readline(paste0("The package 'shiny' must be installed to ",
- "launch the Rnaught web application.\nWould you like to install it? ",
- "[Y/n] "))
+ missing_pkgs <- c(missing_pkgs, "shiny")
+ }
+ if (!requireNamespace("bslib", quietly = TRUE)) {
+ missing_pkgs <- c(missing_pkgs, "bslib")
+ }
+ if (!requireNamespace("DT", quietly = TRUE)) {
+ missing_pkgs <- c(missing_pkgs, "DT")
+ }
+
+ # If any of the required packages are missing,
+ # prompt the user to install them.
+ if (length(missing_pkgs) > 0) {
+ cat("The following packages must be installed to run the",
+ "Rnaught web application:\n"
+ )
+ writeLines(missing_pkgs)
+ answer <- readline("Begin installation? [Y/n] ")
- if (answer == "Y" || answer == "y")
- install.packages("shiny")
- else
- stop("Aborting.", call. = FALSE)
+ if (answer == "Y" || answer == "y") {
+ install.packages(missing_pkgs)
+ } else {
+ stop("Aborting due to missing, required packages.", call. = FALSE)
+ }
}
- shiny::shinyApp(ui(), server)
+ shiny::runApp(appDir = system.file("app", package = "Rnaught"))
}