Skip to content

Commit

Permalink
CRAN ready
Browse files Browse the repository at this point in the history
  • Loading branch information
“rafal.urn” committed Aug 20, 2024
1 parent 0addd8f commit b4c9b33
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 621 deletions.
File renamed without changes.
13 changes: 7 additions & 6 deletions ShinyWizard/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ Description: Shiny wizard to build an interactive presentation of any R package.
License: GPL (>= 3)
Encoding: UTF-8
Imports:
base,
shiny,
rstudioapi
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
Suggests:
testthat (>= 3.0.0),
devtools,
shinythemes,
shinydashboard,
Expand All @@ -18,10 +24,5 @@ Imports:
readr,
stringr,
bslib,
reshape2,
rstudioapi
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
Suggests:
testthat (>= 3.0.0)
reshape2
Config/testthat/edition: 3
595 changes: 0 additions & 595 deletions ShinyWizard/LICENSE.md

This file was deleted.

18 changes: 9 additions & 9 deletions ShinyWizard/R/RunShinyWizzard.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ RunShinyWizard <- function(loc = NULL, devMode = FALSE){
TempPath <- tempdir()

# Copy all original files
file.copy(system.file("source", package = "ShinyWizard"), TempPath, recursive=TRUE)
base::file.copy(system.file("source", package = "ShinyWizard"), TempPath, recursive=TRUE)

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

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


}else{

if (file.exists(loc) && !dir.exists(loc)){ #TRUE => file, unzip & rerun
if (base::file.exists(loc) && !base::dir.exists(loc)){ #TRUE => file, unzip & rerun

# is loc = <.zip file with project> zip file contains only tabs
# config$TempProjPath
Expand All @@ -39,11 +39,11 @@ RunShinyWizard <- function(loc = NULL, devMode = FALSE){

# is loc = <tempDir> Run temp app
# Copy all original files
file.copy(system.file("source/core", package = "ShinyWizard"), loc, recursive=TRUE)
file.copy(system.file("source/global.R", package = "ShinyWizard"), loc, recursive=TRUE)
file.copy(system.file("source/server.R", package = "ShinyWizard"), loc, recursive=TRUE)
file.copy(system.file("source/ui.R", package = "ShinyWizard"), loc, recursive=TRUE)
file.copy(system.file("source/www", package = "ShinyWizard"), loc, recursive=TRUE)
base::file.copy(base::system.file("source/core", package = "ShinyWizard"), loc, recursive=TRUE)
base::file.copy(base::system.file("source/global.R", package = "ShinyWizard"), loc, recursive=TRUE)
base::file.copy(base::system.file("source/server.R", package = "ShinyWizard"), loc, recursive=TRUE)
base::file.copy(base::system.file("source/ui.R", package = "ShinyWizard"), loc, recursive=TRUE)
base::file.copy(base::system.file("source/www", package = "ShinyWizard"), loc, recursive=TRUE)

# Run project
write(paste0("shiny::runApp('", loc,"', launch.browser = TRUE)"), paste0(loc, "run.R"))
Expand Down
8 changes: 5 additions & 3 deletions ShinyWizard/R/ShinyWizzardIncludeCSSAndTheme.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#' ShinyWizzardIncludeCSSAndTheme
#'
#' @param ShinyWizzardTheme ShinyWizzard theme name returned by config$ShinyWizzardTheme
#'
# @export

ShinyWizzardIncludeCSSAndTheme <- function(){
ShinyWizzardIncludeCSSAndTheme <- function(ShinyWizzardTheme){

if(config$ShinyWizzardTheme != ""){
includeCSS(ShinyWizzardTheme(config$ShinyWizzardTheme))
if(ShinyWizzardTheme != ""){
shiny::includeCSS(ShinyWizzardTheme(ShinyWizzardTheme))
}else{cat("config$ShinyWizzardTheme is empty!")}


Expand Down
14 changes: 7 additions & 7 deletions ShinyWizard/R/ShinyWizzardTheme.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@

ShinyWizzardTheme <- function(name = ""){

templatesPath <- system.file("templates", package = "ShinyWizard")
templatesList <- list.files(paste0(templatesPath, "/css/"))
templatesPath <- base::system.file("templates", package = "ShinyWizard")
templatesList <- base::list.files(paste0(templatesPath, "/css/"))
# Ext only names
templatesList <- substr(templatesList, 1, nchar(templatesList)-8)
templatesList <- base::substr(templatesList, 1, base::nchar(templatesList)-8)
if ( name == ""){
return(templatesList)
}else{
if(file.exists(paste0(templatesPath, "/css/", name, ".min.css"))){
if(base::file.exists(paste0(templatesPath, "/css/", name, ".min.css"))){
return(paste0(templatesPath, "/css/", name, ".min.css"))
}else{
stop("The template name '", name, "' is not avaliable. Please use one of ", paste(ShinyWizzardTheme(), collapse=", "))}
stop("The template name '", name, "' is not avaliable. Please use one of ", base::paste(ShinyWizzardTheme(), collapse=", "))}
}
}

Expand Down Expand Up @@ -76,7 +76,7 @@ ShinyWizzardThemeSelector <- function() {
#'

allThemes <- function() {
themes <- dir(system.file("shinythemes/css", package = "shinythemes"),
themes <- base::dir(base::system.file("shinythemes/css", package = "shinythemes"),
".+\\.min.css")
sub(".min.css", "", themes)
base::sub(".min.css", "", themes)
}
5 changes: 4 additions & 1 deletion ShinyWizard/man/ShinyWizzardIncludeCSSAndTheme.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b4c9b33

Please sign in to comment.