The migration process is still being written, so here are my notes for this repo:
BIG NOTE: At some point, {pegboard} started failing its tests in part due to it being too specific for its searches.
Here’s what I did in R:
::create_from_github("swcarpentry/r-novice-gapminder", open = FALSE)
usethis::create_lesson("new-programming-with-r")
sandpaper::use_github() usethis
I then went to github and manually changed the branch from master to main.
Back in R in the project:
# Read the episodes into R
"../r-novice-gapminder"
src <- pegboard::Lesson$new(src)
rni <-
# Script to transform the episodes via pegboard with traces
function(e, out = here::here()) {
transform <- fs::path(out, "episodes/")
outdir <-message(glue::glue("{e$name}: converting blockquotes to fenced div"))
$unblock()
emessage(glue::glue("{e$name}: removing Jekyll syntax"))
$use_sandpaper()
emessage(glue::glue("{e$name}: moving yaml items to body"))
$move_questions()
e$move_objectives()
e$move_keypoints()
emessage(glue::glue("{e$name}: writing output"))
$write(outdir, format = "Rmd", edit = FALSE)
e
}
# Transform and write to our episodes folder
::walk(rni$episodes, ~try(transform(.x)))
purrr
# Transform reference
Episode$new(fs::path(src, "reference.md"))
ref <-$use_sandpaper()$write("learners/")
ref
# Transform setup
Episode$new(fs::path(src, "setup.md"))
setup <-$use_sandpaper()$write("learners/")
setup
# Transform index
Episode$new(fs::path(src, "index.md"))
index <-$use_sandpaper()$write(here())
index
# Copy README
::file_copy(fs::path(src, "README.md"), "README.md")
fs
# Copy Figures (N.B. this was one of the pain points for the Jekyll lessons: figures lived above the RMarkdown documents)
::file_copy(fs::dir_ls(fs::path(src, "fig"), glob = "*svg"), here("episodes", "fig"))
fs
# Copy the data file to the data folder
::dir_copy(fs::path(src, "_episodes_rmd/data/", "episodes/"))
fs fs::dir_ls(fs::path(src, "r-novice-gapminder/_episodes_rmd/"), glob = "*.R")
rscripts <-::file_copy(rscripts, "episodes/", overwrite = TRUE)
fs::file_delete("episodes/01-introduction.Rmd")
fs::file_delete("learners/Setup.md") fs
After this was done, I added the .github/
configuration files from https://github.com/zkamvar/testme. I then ran sandpaper::build_lesson()
to test that it worked (there’s something going on with the formatting, but nothing need be changed on this end).
I then used the following steps to update the config file
library("sandpaper")
# set the order of the learner files
get_learners()
learn <-set_learners(order = learn, write = TRUE)
# set the order of the episode files
get_episodes()
ep <-set_episodes(order = ep, write = TRUE)
I ran into a bug with {sandpaper} that will be fixed soon, but it luckily does not affect the results.
I committed all the bits and pushed the results to github where everything was able to install (after I made sure the dependencies were taken care of).
At this moment, I am finishing up the notes for the migration and setting up the configuration file.