Commit e45776dc authored by jlopez's avatar jlopez
Browse files

Init project

parents
# History files
.Rhistory
.Rapp.history
sag.Rproj
# Session Data files
.RData
# Example code in package build process
*-Ex.R
# Output files from R CMD build
/*.tar.gz
# Output files from R CMD check
/*.Rcheck/
# RStudio files
.Rproj.user/
# produced vignettes
vignettes/*.html
vignettes/*.pdf
# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
.httr-oauth
# knitr and R markdown default cache directories
/*_cache/
/cache/
# Temporary files created by R markdown
*.utf8.md
*.knit.md
.Rproj.user
MenuGauche = sidebarMenu(id="sidebarmenu",
menuItem("Home", tabName="Home", icon=icon("home", lib="font-awesome"), newtab=FALSE),
tags$br(),
menuItem("Powered by mbb", href="http://mbb.univ-montp2.fr/MBB/index.php", newtab=TRUE, icon=icon("book", lib="font-awesome"), selected=NULL)
)
#@author jimmy.lopez@univ-montp2.fr
library(shiny)
library(shinydashboard)
library(shinyjs)
library(yaml)
library(stringr)
library(shinyFiles)
library(tools)
source("./R/menugauche.R", local=T)
style <- tags$style(HTML(readLines("www/added_styles.css")))
UI <- dashboardPage(
skin="purple",
dashboardHeader(title="Pipeline in R", titleWidth=230),
dashboardSidebar(width=230, MenuGauche),
dashboardBody(
shinyjs::useShinyjs(),
tags$head(tags$link(rel="stylesheet", type="text/css", href="bootstrap.min.readable.css")),
tags$head(style),
tabItems(
)
)
)
server <- function( input, output, session) {
}
shinyApp(ui = UI, server = server)
App:
project: "/home/jimmy/jimmy/projets/sag/app/pipeline"
general:
title: "Pipeline in R"
skin: "purple"
source("tools.R")
library(yaml)
path_yml <- "/home/jimmy/jimmy/projets/sag/app/pipelineR.yml"
APP <<- yaml.load_file(path_yml)$App
generate_added_styles <- function () {
path_css = APP$project + "/www/added_styles.css"
file.create(path_css)
}
#============================================================
generate_menu <- function() {
path_file = APP$project + "/R/menugauche.R"
file.create(path_file)
res <- ""
res <- res + 'MenuGauche = sidebarMenu(id="sidebarmenu",\n'
res <- res + ' menuItem("Home", tabName="Home", icon=icon("home", lib="font-awesome"), newtab=FALSE),\n'
res <- res + ' tags$br(),\n'
res <- res + ' menuItem("Powered by mbb", href="http://mbb.univ-montp2.fr/MBB/index.php", newtab=TRUE, icon=icon("book", lib="font-awesome"), selected=NULL)\n'
res <- res + ')\n'
write(res, file = path_file)
}
#============================================================
generate <- function() {
print("Generate Start")
if(dir.exists(APP$project)) {
unlink(APP$project, recursive=TRUE)
}
dir.create(APP$project)
generate_app()
dir.create(APP$project + "/R")
generate_menu()
dir.create(APP$project + "/pages")
dir.create(APP$project + "/server")
dir.create(APP$project + "/www")
generate_added_styles()
print("Generate End")
}
#============================================================
generate_app <- function() {
path_project = APP$project + "/app.R"
main = APP$general
file.create(path_project)
res <- "#@author jimmy.lopez@univ-montp2.fr\n\n"
res <- res + "library(shiny)\n"
res <- res + "library(shinydashboard)\n"
res <- res + "library(shinyjs)\n"
res <- res + "library(yaml)\n"
res <- res + "library(stringr)\n"
res <- res + "library(shinyFiles)\n"
res <- res + "library(tools)\n"
res <- res + "\n"
res <- res + "source(\"./R/menugauche.R\", local=T)\n"
res <- res + "\n"
res <- res + "style <- tags$style(HTML(readLines(\"www/added_styles.css\")))\n"
res <- res + "UI <- dashboardPage(\n"
res <- res + ' skin="' + main$skin + '",\n'
res <- res + ' dashboardHeader(title="'+ main$title + '", titleWidth=230),\n'
res <- res + " dashboardSidebar(width=230, MenuGauche),\n"
res <- res + " dashboardBody(\n"
res <- res + " shinyjs::useShinyjs(),\n"
res <- res + ' tags$head(tags$link(rel=\"stylesheet\", type=\"text/css\", href=\"bootstrap.min.readable.css\")),\n'
#tags$head(tags$script(src="message-handler.js")),
res <- res + "tags$head(style),\n"
res <- res + " tabItems(\n"
res <- res + " )\n"
res <- res + ")\n"
res <- res + ")\n"
res <- res + "\n"
res <- res + "server <- function( input, output, session) {\n"
res <- res + "\n"
res <- res + "}\n"
res <- res + "\n"
res <- res + "shinyApp(ui = UI, server = server)"
write(res, path_project)
}
#============================================================
generate()
`+` <- function(e1, e2) {
if (is.character(e1) | is.character(e2)) {
paste0(e1, e2)
} else {
base::`+`(e1, e2)
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment