From f1df5f92f7ac20513bc4eb80552856d311c15f18 Mon Sep 17 00:00:00 2001 From: Chris <53177842+ChristopherMarais@users.noreply.github.com> Date: Sat, 24 Feb 2024 19:38:47 -0500 Subject: [PATCH] Test app.R in root standard for rsconnect --- 05_DASHBOARD/deploy-dev.R | 4 ++-- 05_DASHBOARD/deploy.R | 4 ++-- 05_DASHBOARD/app.R => app.R | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) rename 05_DASHBOARD/app.R => app.R (96%) diff --git a/05_DASHBOARD/deploy-dev.R b/05_DASHBOARD/deploy-dev.R index 1b235b9..5fa025b 100644 --- a/05_DASHBOARD/deploy-dev.R +++ b/05_DASHBOARD/deploy-dev.R @@ -31,7 +31,7 @@ rsconnect::setAccountInfo( # Deploy req_files <- list_all_files(c("./04_Tests", "./03_Data_for_app")) # get all the required files rsconnect::deployApp( - appDir = "./05_DASHBOARD", - appFiles = c("app.R", req_files), + # appDir = "./05_DASHBOARD", + # appFiles = c("app.R", req_files), appName = "Dashboard-dev", forceUpdate = TRUE) diff --git a/05_DASHBOARD/deploy.R b/05_DASHBOARD/deploy.R index 1cbe136..2100d51 100644 --- a/05_DASHBOARD/deploy.R +++ b/05_DASHBOARD/deploy.R @@ -9,7 +9,7 @@ rsconnect::setAccountInfo( # Deploy rsconnect::deployApp( - appDir = "./05_DASHBOARD", - appFiles = "app.R", + # appDir = "./05_DASHBOARD", + # appFiles = "app.R", appName = "Dashboard", forceUpdate = TRUE) diff --git a/05_DASHBOARD/app.R b/app.R similarity index 96% rename from 05_DASHBOARD/app.R rename to app.R index 8d71a29..c4e3bfb 100644 --- a/05_DASHBOARD/app.R +++ b/app.R @@ -39,20 +39,20 @@ find_directory_of_file <- function(file_name, start_dir=getwd()) { # find file_name from current working directory # before trying from a shallower directory -file_name <- "*DASHBOARD/app.R" # The file you are searching for +file_name <- "*app.R" # The file you are searching for try({ found_dir <- find_directory_of_file(file_name) # Check if found_dir is NULL or empty, indicating the file was not found if (is.null(found_dir) || length(found_dir) == 0) { # print error - print("05_DASHBOARD/app.R not found from current working directory!") + print("app.R not found from current working directory!") print("trying again from shallower directory") # trying again from great grandparent directory of working directory setwd("../../..") found_dir <- find_directory_of_file(file_name) if (is.null(found_dir) || length(found_dir) == 0) { - print("05_DASHBOARD/app.R likely does not exist in filesystem!") + print("app.R likely does not exist in filesystem!") } # Set working directory to parent directory of found dir setwd(fs::path_dir(found_dir[1])) @@ -60,7 +60,7 @@ try({ print(paste0("Working dir: ", getwd())) } # Set working directory to parent directory of found dir - setwd(fs::path_dir(found_dir[1])) + setwd(found_dir[1]) # Print working directory print(paste0("Working dir: ", getwd())) }, silent = FALSE) # Setting silent = FALSE will print the error message to the console