Skip to content

Commit

Permalink
fix: create CITATION.cff in the appropriate function
Browse files Browse the repository at this point in the history
  • Loading branch information
ahasverus committed Oct 23, 2023
1 parent 04da74c commit 8963f7b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 25 deletions.
25 changes: 0 additions & 25 deletions R/add_citation.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@
#' contains a BiBTeX entry to cite the package as a manual. User will need to
#' edit by hand some information (title, version, etc.).
#'
#' Two additional files are also created:
#' - a `CITATION.cff` file: a plain text file with human- and machine-readable
#' citation information for software. This file is a feature introduced by
#' GitHub. For more information:
#' \url{https://ropensci.org/blog/2021/11/23/cffr/}.
#' - a `.github/workflows/update-citation-cff.yaml` file: a configuration file
#' to setup GitHub Actions to update the `CITATION.cff` each time the
#' `DESCRIPTION` file or the `inst/CITATION` is modified.
#'
#' @param organisation A character of length 1. The name of the GitHub
#' organisation to host the package. If `NULL` (default) the GitHub account
#' will be used. This argument is used to set the URL of the package
Expand Down Expand Up @@ -119,23 +110,7 @@ add_citation <- function(given = NULL, family = NULL, organisation = NULL,
## Messages ----

if (!quiet) ui_done("Writing {ui_value('inst/CITATION')} file")


## Add CITATION.cff file ----

cffr::cff_write(verbose = FALSE)


## Messages ----

if (!quiet) ui_done("Writing {ui_value('CITATION.cff')} file")


## Add Github action to update CITATION.cff ----

add_github_actions_citation(overwrite = TRUE)


if (open) edit_file(path)

invisible(NULL)
Expand Down
12 changes: 12 additions & 0 deletions R/add_github_actions_citation.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#' from \url{https://github.com/r-lib/actions/tree/v2-branch/examples}.
#' This file will be written as `.github/workflows/update-citation-cff.yaml`.
#'
#' This function also create the `CITATION.cff` using the package [cffr].
#'
#' @param open A logical value. If `TRUE` (default) the file is opened in the
#' editor.
#'
Expand Down Expand Up @@ -73,6 +75,16 @@ add_github_actions_citation <- function(open = FALSE, overwrite = FALSE,
ui_done(paste0("Writing {ui_value('.github/workflows/",
"update-citation-cff.yaml')} file"))


## Add CITATION.cff file ----

cffr::cff_write(verbose = FALSE)


## Messages ----

if (!quiet) ui_done("Writing {ui_value('CITATION.cff')} file")

if (open) edit_file(path)

invisible(NULL)
Expand Down

0 comments on commit 8963f7b

Please sign in to comment.