Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
“rafal.urn” committed Aug 17, 2024
1 parent d54f8bf commit 132000f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Imports:
readr,
stringr,
bslib,
reshape2
reshape2,
rstudioapi
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.0
Suggests:
Expand Down
22 changes: 17 additions & 5 deletions R/RunShinyWizzard.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#'
#' @export

RunShinyWizard <- function(loc = NULL){
RunShinyWizard <- function(loc = NULL, devMode = FALSE){

if (is.null(loc)){ # Run creator

Expand All @@ -16,8 +16,14 @@ RunShinyWizard <- function(loc = NULL){

# Run project
write(paste0("shiny::runApp('",paste0(TempPath, "/source/"),"', launch.browser = TRUE)"), paste0(TempPath, "/run.R"))
system2("Rscript", paste0(TempPath, "/run.R"))
# rstudioapi::jobRunScript(paste0(TempPath, "/run.R"))

# Dev Mode uses rstudioapi
if (devMode){
rstudioapi::jobRunScript(paste0(TempPath, "/run.R"))
}else{
system2("Rscript", paste0(TempPath, "/run.R"))
}


}else{

Expand All @@ -40,8 +46,14 @@ RunShinyWizard <- function(loc = NULL){

# Run project
write(paste0("shiny::runApp('", loc,"', launch.browser = TRUE)"), paste0(loc, "run.R"))
system2("Rscript", paste0(loc, "run.R"))
# rstudioapi::jobRunScript(paste0(loc, "run.R"))

# Dev Mode uses rstudioapi
if (devMode){
rstudioapi::jobRunScript(paste0(loc, "run.R"))
}else{
system2("Rscript", paste0(loc, "run.R"))
}

}
}

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ ShinyWizard::RunShinyWizard()

[2. Documentation](#2-documentation)
- [2.1 Functions](#21-functions)
- [2.1.1 RunShinyWizard](#211-RunShinyWizard)
- [2.2 Examples](#22-examples)
- [2.3 Tutorials](#23-tutorials)

Expand Down Expand Up @@ -59,6 +60,11 @@ The documentation for package including user guides, package vignettes, descript
# To show the manual and functions' descriptions
help(package = "ShinyWizard")
```
#### 2.1.1 RunShinyWizard

RunShinyWizard(loc = NULL, devMode = FALSE)

devMode - when TRUE the developer mode is used. It means all tasks run by separate background jobs thus console is not blocked. It works by R Studio API so works only in R studio. It is mode only for development facilitate. Should not be used for production.

### 2.2 Examples

Expand Down

0 comments on commit 132000f

Please sign in to comment.