Skip to contents

This function is now deprecated in favour of validate_lesson().

Usage

check_lesson(path = ".")

Arguments

path

the path to your lesson

Value

TRUE (invisibly) if the lesson is cromulent, otherwise, it will error with a list of things to fix.

Examples


# Everything should work out of the box
tmp <- tempfile()
create_lesson(tmp, open = FALSE, rmd = FALSE)
#> → Creating Lesson in /tmp/RtmpeI6Keh/file16e57f6fce47...
#>  No schedule set, using Rmd files in episodes/ directory.
#> → Creating Lesson in /tmp/RtmpeI6Keh/file16e57f6fce47...

#> To remove this message, define your schedule in config.yaml or use `set_episodes()` to generate it.
#> → Creating Lesson in /tmp/RtmpeI6Keh/file16e57f6fce47...

#> ────────────────────────────────────────────────────────────────────────
#> → Creating Lesson in /tmp/RtmpeI6Keh/file16e57f6fce47...

#>  To save this configuration, use
#> 
#> set_episodes(path = path, order = ep, write = TRUE)
#> → Creating Lesson in /tmp/RtmpeI6Keh/file16e57f6fce47...

#>  Edit /tmp/RtmpeI6Keh/file16e57f6fce47/episodes/introduction.md.
#> → Creating Lesson in /tmp/RtmpeI6Keh/file16e57f6fce47...

#>  First episode created in /tmp/RtmpeI6Keh/file16e57f6fce47/episodes/introduction.md
#> → Creating Lesson in /tmp/RtmpeI6Keh/file16e57f6fce47...

#>  Workflows up-to-date!
#> → Creating Lesson in /tmp/RtmpeI6Keh/file16e57f6fce47...

#>  Lesson successfully created in /tmp/RtmpeI6Keh/file16e57f6fce47
#> → Creating Lesson in /tmp/RtmpeI6Keh/file16e57f6fce47...

#> /tmp/RtmpeI6Keh/file16e57f6fce47
check_lesson(tmp)

# if things do not work, then an error is thrown with information about
# what has failed you
unlink(file.path(tmp, ".gitignore"))
unlink(file.path(tmp, "site"), recursive = TRUE)
try(check_lesson(tmp))
#> ! Path '/tmp/RtmpeI6Keh/file16e57f6fce47/site' does not exist
#> ! The .gitignore file is missing the following elements:
#> episodes/*html
#> site/*
#> !site/README.md
#> .Rhistory
#> .Rapp.history
#> .RData
#> .Ruserdata
#> *-Ex.R
#> /*.tar.gz
#> /*.Rcheck/
#> .Rproj.user/
#> vignettes/*.html
#> vignettes/*.pdf
#> .httr-oauth
#> *_cache/
#> /cache/
#> *.utf8.md
#> *.knit.md
#> .Renviron
#> docs/
#> po/*~
#> ! The file 'site/README.md' does not exist
#> Error in report_validation(checklist, "There were errors with the lesson structure.") : 
#>   There were errors with the lesson structure.

unlink(tmp)