From 8d741d4de1fd8b4076ac05fc9807d086bbd8b41a Mon Sep 17 00:00:00 2001 From: Aron Atkins Date: Mon, 21 Oct 2024 09:23:21 -0400 Subject: [PATCH] remove remaining layout check fixes #1102 --- NEWS.md | 2 ++ R/appMetadata.R | 17 ----------- tests/testthat/_snaps/appMetadata.md | 8 ----- tests/testthat/test-appMetadata.R | 45 ---------------------------- 4 files changed, 2 insertions(+), 70 deletions(-) diff --git a/NEWS.md b/NEWS.md index 91d7d0d8..82019088 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,8 @@ end-of-file extensions. Previously, a file with `.R` elsewhere in its name, such as `.Rprofile`, was incorrectly considered. (#1106) +* Remove remaining directory layout validation check. (#1102) + * Use the public Connect server API endpoint `/v1/tasks/{id}` to poll task progress. (#1088) diff --git a/R/appMetadata.R b/R/appMetadata.R index 56df16fa..64ecf507 100644 --- a/R/appMetadata.R +++ b/R/appMetadata.R @@ -7,8 +7,6 @@ appMetadata <- function(appDir, isShinyappsServer = FALSE, metadata = list()) { - checkAppLayout(appDir, appPrimaryDoc) - if (is_string(quarto)) { lifecycle::deprecate_warn( when = "1.0.0", @@ -83,21 +81,6 @@ appMetadata <- function(appDir, ) } -checkAppLayout <- function(appDir, appPrimaryDoc = NULL) { - appFilesBase <- tolower(list.files(appDir)) - primaryIsRScript <- identical(tolower(tools::file_ext(appPrimaryDoc)), "r") - - # check for single-file app collision - if (primaryIsRScript && "app.r" %in% appFilesBase) { - cli::cli_abort( - "Project must not contain both {.file app.R} and a single-file Shiny app." - ) - } - - # all other layouts are allowed; the server determines (with the required packages) if the content - # can be run/served. -} - # Infer the mode of the application from included files. Most content types # only consider files at the directory root. TensorFlow saved models may be # anywhere in the hierarchy. diff --git a/tests/testthat/_snaps/appMetadata.md b/tests/testthat/_snaps/appMetadata.md index 03575416..7a3d13e3 100644 --- a/tests/testthat/_snaps/appMetadata.md +++ b/tests/testthat/_snaps/appMetadata.md @@ -15,14 +15,6 @@ Error in `appMetadata()`: ! `quarto` must be `TRUE`, `FALSE`, or `NA`, not the number 1. -# checkLayout() errors if primary doc & app.R - - Code - checkAppLayout(dir, appPrimaryDoc = "myscript.R") - Condition - Error in `checkAppLayout()`: - ! Project must not contain both 'app.R' and a single-file Shiny app. - # errors if no files with needed extension Code diff --git a/tests/testthat/test-appMetadata.R b/tests/testthat/test-appMetadata.R index d51b2e15..2579e5a7 100644 --- a/tests/testthat/test-appMetadata.R +++ b/tests/testthat/test-appMetadata.R @@ -65,51 +65,6 @@ test_that("content type (appMode) is inferred and can be overridden", { # checkLayout ------------------------------------------------------------- -test_that("checkLayout() errors if primary doc & app.R", { - dir <- local_temp_app(list( - "app.R" = "", - "myscript.R" = "" - )) - - expect_snapshot(checkAppLayout(dir, appPrimaryDoc = "myscript.R"), error = TRUE) -}) - -test_that("checkLayout succeeds with some common app structures", { - rmd <- local_temp_app(list("foo.Rmd" = "")) - expect_no_error(checkAppLayout(rmd)) - - qmd <- local_temp_app(list("foo.qmd" = "")) - expect_no_error(checkAppLayout(qmd)) - - # perhaps script.R is a pre-render script that generates *.qmd - project <- local_temp_app(list("_quarto.yml" = "", "script.R" = "")) - expect_no_error(checkAppLayout(project)) - - md <- local_temp_app(list("_quarto.yml" = "", "index.md" = "")) - expect_no_error(checkAppLayout(md)) - - shiny1 <- local_temp_app(list("app.R" = "")) - expect_no_error(checkAppLayout(shiny1)) - - shiny2 <- local_temp_app(list("server.R" = "", "ui.R" = "")) - expect_no_error(checkAppLayout(shiny2)) - - api <- local_temp_app(list("plumber.R" = "")) - expect_no_error(checkAppLayout(api)) - - static <- local_temp_app(list("foo.html" = "")) - expect_no_error(checkAppLayout(static)) - - staticxml <- local_temp_app(list("data.xml" = "")) - expect_no_error(checkAppLayout(staticxml)) - - staticdata <- local_temp_app(list( - "data.txt" = "", - "cats.csv" = "" - )) - expect_no_error(checkAppLayout(staticdata)) -}) - # inferAppMode ------------------------------------------------------------ test_that("can infer mode for API with plumber.R", {