Skip to content

Commit

Permalink
Merge pull request #270 from carpentries/add-engine-customisation
Browse files Browse the repository at this point in the history
update to allow for custom/pinned engines
  • Loading branch information
zkamvar authored Apr 8, 2022
2 parents 8431fc7 + 5fd0102 commit 0818ffa
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: sandpaper
Title: Create and Curate Carpentries Lessons
Version: 0.3.5
Version: 0.3.6
Authors@R: c(
person(given = "Zhian N.",
family = "Kamvar",
Expand Down
11 changes: 11 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# sandpaper 0.3.6

MISC
----

* custom sandpaper and varnish engines will be properly linked to the footer
of the lesson pages via this version and varnish 0.1.8.
* testthat tests have been updated.
* a diagram in the vingettes has been updated to reflect the parallel roles of
sandpaper and pegboard to a lesson.

# sandpaper 0.3.5

BUG FIX
Expand Down
4 changes: 3 additions & 1 deletion R/set_dropdown.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ set_dropdown <- function(path = ".", order = NULL, write = FALSE, folder) {
invisible()
}

#' Set individual keys in a configuration file
#' @param pairs a named character vector with keys as the names and the new
#' values as the contents
#' @inheritParams set_dropdown
#'
#' @export
#' @rdname set_dropdown
set_config <- function(pairs = NULL, path = ".", write = FALSE) {
keys <- names(pairs)
values <- pairs
Expand Down
25 changes: 24 additions & 1 deletion R/utils-varnish.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
varnish_vars <- function() {
ver <- function(pak) glue::glue(" ({packageVersion(pak)})")
cfg <- function(pkg) {
desc <- packageDescription(pkg)
url <- desc[["RemoteUrl"]]
ref <- desc[["RemoteRef"]] %||% "HEAD" # if there is no ref, default to HEAD
vsn <- desc[["Version"]]
if (!is.null(url) && ref == vsn) {
user <- "carpentries"
repo <- pkg
} else {
user <- desc[["RemoteUsername"]]
repo <- desc[["RemoteRepo"]]
}
if (is.null(user) || is.null(repo)) {
return(NULL)
}
if (ref == "HEAD" && !is.null(desc[["RemoteSha"]])) {
ref <- desc[["RemoteSha"]]
}
res <- paste0(user, "/", repo, "/tree/", ref)
return(res)
}
list(
sandpaper_version = ver("sandpaper"),
sandpaper_cfg = cfg("sandpaper"),
pegboard_version = ver("pegboard"),
varnish_version = ver("varnish")
varnish_version = ver("varnish"),
varnish_cfg = cfg("varnish")
)
}

Expand Down
1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ reference:
- validate_lesson
- get_drafts
- get_config
- set_dropdown
- get_episodes
- set_episodes
- get_syllabus
Expand Down
20 changes: 20 additions & 0 deletions man/set_config.Rd

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

6 changes: 0 additions & 6 deletions man/set_dropdown.Rd

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

0 comments on commit 0818ffa

Please sign in to comment.