-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow passing of direct path to app file
- Loading branch information
Showing
5 changed files
with
35 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Validate that we're pointing to a directory. If the user has supplied a | ||
# direct file. E.g. a app.R or app.py file we should back up the app loc to | ||
# the parent location | ||
validateAppLoc <- function(loc) { | ||
|
||
# If the file ends in app.R or ui.R or server.R we should back up the | ||
# location to the parent directory | ||
if (fs::path_ext(loc) %in% "R") { | ||
loc <- fs::path_dir(loc) | ||
} | ||
|
||
loc | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
devtools::load_all(".") | ||
|
||
launch_editor( | ||
app_loc = here::here("scratch/a-brand-new-app3/"), | ||
app_loc = here::here("scratch/a-brand-new-app3"), | ||
port = 8888, | ||
launch_browser = FALSE, | ||
stop_on_browser_close = FALSE | ||
# launch_browser = FALSE, | ||
# stop_on_browser_close = FALSE | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
test_that("Handles being passed path directly to app script, or to folder container app", { | ||
|
||
expect_equal( | ||
validateAppLoc("my/app/loc/app.R"), | ||
validateAppLoc("my/app/loc") | ||
) | ||
|
||
expect_equal( | ||
validateAppLoc("my/app/loc/ui.R"), | ||
validateAppLoc("my/app/loc") | ||
) | ||
}) |
This file was deleted.
Oops, something went wrong.