jhudsl / ottrpal

Tools for converting OTTR courses into Leanpub or Coursera courses :otter:
https://jhudatascience.org/ottrpal/
GNU General Public License v3.0
3 stars 1 forks source link

RStudio Project Template #127

Open howardbaek opened 2 months ago

howardbaek commented 2 months ago

The goal is to give user the option to create a Quarto Based OTTR course with RStudio Project Templates.

The plan is to create a function in this repo, create_rstudio_project_template()

create_rstudio_project_template <- function(path, ...) {
  # ensure path exists
  dir.create(path, recursive = TRUE, showWarnings = FALSE)

 # For each file in the ottr repo,
 # Step 1. Collect inputs and paste together as 'Parameter: Value'
  dots <- list(...)
  text <- lapply(seq_along(dots), function(i) {
    key <- names(dots)[[i]]
    val <- dots[[i]]
    paste0(key, ": ", val)
  })

 # Step 2. Collect into single text string
  contents <- paste(
    paste(header, collapse = "\n"),
    paste(text, collapse = "\n"),
    sep = "\n"
  )

  # Step 3. Write to file
  writeLines(contents, con = file.path(path, "FILE_NAME_HERE"))

 # Repeat Steps 1~3 for each file
}

This way, we can accept user inputs inside an GUI and automatically setup an OTTR repo without having the user open a config file and manually configure things.

howardbaek commented 2 months ago

Examples of dcf files:

howardbaek commented 2 months ago

I couldn't get this working inside ottrpal, so I've created a separate R package that does this: https://github.com/fhdsl/ottrtemplate

howardbaek commented 1 month ago

As a matter of fact, the issue might be with the size of the ottr logo: https://stackoverflow.com/a/78411165/14804653

Let me confirm this. @cansavvy

howardbaek commented 1 month ago

Indeed, the issue was with the size of the image file.

Once I transfer over work I've done in ottrtemplate to ottrpal, I'll delete the repo for ottrtemplate to reduce redundancy.

howardbaek commented 1 month ago

Work has been transferred to https://github.com/jhudsl/ottrpal/tree/127-rstudio-project-template and ottrtemplate has been deleted.