From 626d155cb9dbb82f9f6ee4944b204eb0d3ecac4c Mon Sep 17 00:00:00 2001 From: Victor Navarro Date: Wed, 13 Mar 2024 19:13:21 +0000 Subject: [PATCH] resource naming and referencing --- R/launch_app.R | 2 +- R/ui.R | 4 ++-- .../google_analytics.html | 0 inst/{app_resources => resources}/logo.png | Bin inst/test_deployment.R | 5 +++-- man/calmr_ui.Rd | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) rename inst/{app_resources => resources}/google_analytics.html (100%) rename inst/{app_resources => resources}/logo.png (100%) diff --git a/R/launch_app.R b/R/launch_app.R index 64a46ae..8ba7480 100644 --- a/R/launch_app.R +++ b/R/launch_app.R @@ -5,7 +5,7 @@ launch_app <- function( browser = getOption("shiny.launch.browser", interactive())) { shiny::addResourcePath( "resources", - system.file("app_resources", package = "calmr.app") + system.file("resources", package = "calmr.app") ) ui <- calmr_ui( analytics_file = NULL diff --git a/R/ui.R b/R/ui.R index 7161bcc..f6ab12a 100644 --- a/R/ui.R +++ b/R/ui.R @@ -3,7 +3,7 @@ #' Default is NULL, in which case, no analytics are pushed. #' @export calmr_ui <- function( - analytics_file = "inst/app_resources/google_analytics.html") { + analytics_file = "inst/resources/google_analytics.html") { if (!is.null(analytics_file)) { analytics <- htmltools::includeHTML(analytics_file) } else { @@ -207,7 +207,7 @@ calmr_ui <- function( tabName = "about", shiny::fluidPage( htmltools::HTML( - '
' + '
' ), htmltools::br(), htmltools::br(), htmltools::HTML('Canonical Associative Learning Models diff --git a/inst/app_resources/google_analytics.html b/inst/resources/google_analytics.html similarity index 100% rename from inst/app_resources/google_analytics.html rename to inst/resources/google_analytics.html diff --git a/inst/app_resources/logo.png b/inst/resources/logo.png similarity index 100% rename from inst/app_resources/logo.png rename to inst/resources/logo.png diff --git a/inst/test_deployment.R b/inst/test_deployment.R index 82510b4..db34d55 100644 --- a/inst/test_deployment.R +++ b/inst/test_deployment.R @@ -6,13 +6,14 @@ devtools::install_github("victor-navarro/calmr", force = TRUE) tmp <- tempdir() file.copy("R/server.R", file.path(tmp, "server.R")) file.copy("R/ui.R", file.path(tmp, "ui.R")) -file.copy("inst/app_resources", tmp, recursive = TRUE) +file.copy("inst/resources", tmp, recursive = TRUE) shiny::addResourcePath( "resources", - system.file("app_resources", package = "calmr.app") + system.file("resources", package = "calmr.app") ) rsconnect::deployApp(tmp, + appName = "calmr_app_test", forceUpdate = TRUE ) diff --git a/man/calmr_ui.Rd b/man/calmr_ui.Rd index 3a6071b..e1498c0 100644 --- a/man/calmr_ui.Rd +++ b/man/calmr_ui.Rd @@ -4,7 +4,7 @@ \alias{calmr_ui} \title{Build calmr.app UI} \usage{ -calmr_ui(analytics_file = "inst/app_resources/google_analytics.html") +calmr_ui(analytics_file = "inst/resources/google_analytics.html") } \arguments{ \item{analytics_file}{A path to google analytics.