]> nmode's Git Repositories - Rnaught/blobdiff - R/app.R
Rename WP
[Rnaught] / R / app.R
diff --git a/R/app.R b/R/app.R
index 64b5d2a3925eb163e9ee7ef0cab8eea83ec9d85d..945f9e4634d61a2052d3d0ccde41071959b18d54 100644 (file)
--- a/R/app.R
+++ b/R/app.R
@@ -1,11 +1,19 @@
 #' Launch the Rnaught Web Application
 #'
+#' @importFrom utils install.packages
+#'
 #' @export
 app <- function() {
-    if (!requireNamespace("shiny", quietly=TRUE))
-        stop("The package 'shiny' must be installed to launch the Rnaught web application.")
-    if (!requireNamespace("shinyBS", quietly=TRUE))
-        stop("The package 'shinyBS' must be installed to launch the Rnaught web application.")
+  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] "))
+
+    if (answer == "Y" || answer == "y")
+      install.packages("shiny")
+    else
+      stop("Aborting.", call. = FALSE)
+  }
 
-    shiny::shinyApp(ui(), server)
+  shiny::shinyApp(ui(), server)
 }