Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add template CFF #583

Merged
merged 3 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions R/create_lesson.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ create_lesson <- function(path, name = fs::path_file(path), rmd = TRUE, rstudio
copy_template("conduct", path, "CODE_OF_CONDUCT.md")
copy_template("license", path, "LICENSE.md")
copy_template("contributing", path, "CONTRIBUTING.md")
copy_template("citation", path, "CITATION.cff")
copy_template("setup", fs::path(path, "learners"), "setup.md")
copy_template("index", path, "index.md")
copy_template("links", path, "links.md")
Expand Down
4 changes: 4 additions & 0 deletions R/template.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ template_episode <- generate_template_function("episode")
#' @export
template_links <- generate_template_function("links")

#' @rdname template
#' @export
template_citation <- generate_template_function("citation")

#' @rdname template
#' @export
template_config <- generate_template_function("config")
Expand Down
22 changes: 22 additions & 0 deletions inst/templates/citation-template.txt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the sparsity of the CFF template.
Would it make sense to include repository-code in this as well, to record the lesson development repo?
Could completing the field even be automated when the user interacts with, e.g., GitHub? 🤷

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sdruskat I had considered adding this field, and other fields I would recommend such as identifiers, but in the end opted for a "minimum viable lesson CFF". I am trying to supplement this template content with documentation elsewhere (e.g. in the Collaborative Lesson Development Training curriculum and the Workbench docs).

TBH we are also still figuring out exactly what guidance we want to give the community about the information they put into their CFFs: creating them is the easy part, but updating them as the lesson develops and matures is more tricky...

I'm afraid the kind of automated filling of information you mentioned is not possible right now, but would indeed be a cool development for the future.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing I've asked is how do we cross-reference to another CFF (adding tons of authors would make this cumbersome). I got a response for this in citation-file-format/citation-file-format#538 (comment) which I think may be useful (CI is one option, reference to the CFF file directly is another)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ocaisa. I guess I need to open a new issue somewhere to keep track of what advice we should give people about CFF, which would include your suggestion. I think docs.carpentries.org is the appropriate place.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This template CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to replace its contents
# with information about your lesson.
# Remember to update this file periodically,
# ensuring that the author list and other fields remain accurate.

cff-version: 1.2.0
title: FIXME
message: >-
Please cite this lesson using the information in this file
when you refer to it in publications, and/or if you
re-use, adapt, or expand on the content in your own
training material.
type: dataset
authors:
- given-names: FIXME
family-names: FIXME
abstract: >-
FIXME Replace this with a short abstract describing the
lesson, e.g. its target audience and main intended
learning objectives.
license: CC-BY-4.0
5 changes: 5 additions & 0 deletions tests/testthat/test-create_lesson.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ test_that("All template files exist", {
expect_true(fs::file_exists(fs::path(tmp, "episodes", "introduction.Rmd")))
expect_true(fs::file_exists(fs::path(tmp, ".gitignore")))
expect_true(fs::file_exists(fs::path(tmp, paste0(basename(tmp), ".Rproj"))))
expect_true(fs::file_exists(fs::path(tmp, "CITATION.cff")))
})

test_that("Templated files are correct", {
Expand All @@ -74,6 +75,10 @@ test_that("Templated files are correct", {
readLines(fs::path(tmp, "episodes", "introduction.Rmd")),
strsplit(expected, "\n")[[1]]
)
expect_setequal(
readLines(fs::path(tmp, "CITATION.cff")),
readLines(template_citation())
)

})

Expand Down
Loading