diff --git a/CITATION.cff b/CITATION.cff index f16ce41..fb76f56 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -10,6 +10,9 @@ license: GPL-3.0-or-later title: 'cffr: Generate Citation File Format (''cff'') Metadata for R Packages' version: 1.0.1.9000 doi: 10.21105/joss.03900 +identifiers: +- type: doi + value: 10.32614/CRAN.package.cffr abstract: The Citation File Format version 1.2.0 is a human and machine readable file format which provides citation metadata for software. This package provides core utilities to generate and validate this metadata. @@ -108,6 +111,7 @@ references: given-names: Gábor email: csardi.gabor@gmail.com year: '2024' + doi: 10.32614/CRAN.package.cli version: '>= 2.0.0' - type: software title: desc @@ -125,6 +129,7 @@ references: given-names: Jim email: james.f.hester@gmail.com year: '2024' + doi: 10.32614/CRAN.package.desc version: '>= 1.3.0' - type: software title: jsonlite @@ -141,6 +146,7 @@ references: identifiers: - type: url value: https://arxiv.org/abs/1403.2805 + doi: 10.32614/CRAN.package.jsonlite version: '>= 1.7.2' - type: software title: jsonvalidate @@ -159,6 +165,7 @@ references: - family-names: Poberezkin given-names: Evgeny year: '2024' + doi: 10.32614/CRAN.package.jsonvalidate version: '>= 1.1.0' - type: software title: yaml @@ -193,6 +200,7 @@ references: - family-names: Kamvar given-names: Zhian N. year: '2024' + doi: 10.32614/CRAN.package.yaml version: '>= 2.2.1' - type: software title: bibtex @@ -210,6 +218,7 @@ references: email: diego.hernangomezherrero@gmail.com orcid: https://orcid.org/0000-0001-8457-4658 year: '2024' + doi: 10.32614/CRAN.package.bibtex version: '>= 0.5.0' - type: software title: knitr @@ -223,6 +232,7 @@ references: email: xie@yihui.name orcid: https://orcid.org/0000-0003-0645-5666 year: '2024' + doi: 10.32614/CRAN.package.knitr - type: software title: lifecycle abstract: 'lifecycle: Manage the Life Cycle of your Package Functions' @@ -238,6 +248,7 @@ references: email: hadley@posit.co orcid: https://orcid.org/0000-0003-4757-117X year: '2024' + doi: 10.32614/CRAN.package.lifecycle - type: software title: rmarkdown abstract: 'rmarkdown: Dynamic Documents for R' @@ -281,6 +292,7 @@ references: email: rich@posit.co orcid: https://orcid.org/0000-0003-3925-190X year: '2024' + doi: 10.32614/CRAN.package.rmarkdown - type: software title: testthat abstract: 'testthat: Unit Testing for R' @@ -292,6 +304,7 @@ references: given-names: Hadley email: hadley@posit.co year: '2024' + doi: 10.32614/CRAN.package.testthat version: '>= 3.0.0' - type: software title: usethis @@ -317,4 +330,5 @@ references: email: andy.teucher@posit.co orcid: https://orcid.org/0000-0002-7840-692X year: '2024' + doi: 10.32614/CRAN.package.usethis diff --git a/NEWS.md b/NEWS.md index e14e3ad..3105331 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,14 @@ # cffr (development version) +- Now **cffr** adds automatically dois to packages on **CRAN** (e.g. + ): + - If the package has a `CITATION` file providing a doi, the `CITATION` doi + would be used as the main `CITATION.cff` `doi` and the **CRAN** doi + would be added as an `identifier`. + - Otherwise, **CRAN** doi would be used as `doi`. + - When extracting dependencies (e.g `cff_create(dependencies = TRUE)` and + the package dependency is on **CRAN**, the **CRAN** doi would be used + for the dependency in the `references` key. - Extract `commit` from `RemoteSha`. # cffr 1.0.1 diff --git a/R/cff_read.R b/R/cff_read.R index f071d3e..0b200db 100644 --- a/R/cff_read.R +++ b/R/cff_read.R @@ -179,7 +179,8 @@ cff_read_description <- function(path, cff_version = "1.2.0", contact = get_desc_contacts(pkg), keywords = get_desc_keywords(pkg), license = unlist(get_desc_license(pkg)), - commit = get_desc_sha(pkg) + commit = get_desc_sha(pkg), + doi = get_desc_doi(pkg) ) if (gh_keywords) { diff --git a/R/utils-cff_read.R b/R/utils-cff_read.R index 5388c09..45ad56d 100644 --- a/R/utils-cff_read.R +++ b/R/utils-cff_read.R @@ -366,3 +366,13 @@ get_desc_sha <- function(pkg) { sha } + +get_desc_doi <- function(pkg) { + pkg <- pkg$get("Package") + if (is.null(search_on_repos(pkg))) { + return(NULL) + } + + doi <- paste0("10.32614/CRAN.package.", pkg) + clean_str(doi) +} diff --git a/R/utils-create.R b/R/utils-create.R index c0de28b..8a9e8ee 100644 --- a/R/utils-create.R +++ b/R/utils-create.R @@ -6,6 +6,15 @@ merge_desc_cit <- function(cffobj, citobj) { if (is.null(citobj)) { return(cffobj) } + # Play with cran DOI + cran_doi <- NULL + has_cran_doi <- FALSE + if (all(!is.null(cffobj$doi), grepl("CRAN", cffobj$doi))) { + has_cran_doi <- TRUE + cran_doi <- cffobj$doi + # First the citation object + cffobj$doi <- NULL + } # Add doi from citation if missing if (is.null(cffobj$doi)) { @@ -21,8 +30,16 @@ merge_desc_cit <- function(cffobj, citobj) { # Merge identifiers - oldids <- cffobjend$identifiers - cffobjend$identifiers <- c(citobj[[1]]$identifiers, oldids) + merged_ids <- c(citobj[[1]]$identifiers, cffobjend$identifiers) + + + if (has_cran_doi) { + cranid <- as_cff(list( + list(type = "doi", value = clean_str(cran_doi)) + )) + merged_ids <- c(cranid, merged_ids) + } + cffobjend$identifiers <- merged_ids # Reorder cffobjfinal <- c( @@ -136,6 +153,10 @@ get_dependencies <- function(desc_path, # Avoid cluttering the output mod$abstract <- mod$title mod$title <- n$package + # If on CRAN add CRAN DOI + if (!is.null(n$package)) { + mod$doi <- paste0("10.32614/CRAN.package.", n$package) + } } mod$type <- "software" diff --git a/R/utils-schema.R b/R/utils-schema.R index 29c7e06..4f7fee4 100644 --- a/R/utils-schema.R +++ b/R/utils-schema.R @@ -83,19 +83,19 @@ cff_schema_keys <- function(sorted = FALSE) { "title", "version", "doi", + "identifiers", "abstract", "authors", "preferred-citation", "repository", "repository-artifact", "repository-code", + "commit", "url", "date-released", "contact", "keywords", "references", - "commit", - "identifiers", "license-url" ) } diff --git a/README.md b/README.md index 29a5018..b23940e 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ file and the `CITATION` file (if present) of your package. Note that **cffr** works best if your package pass `R CMD check/devtools::check()`. -As per 2024-06-12 there are at least 271 repos on GitHub using **cffr**. +As per 2024-06-13 there are at least 261 repos on GitHub using **cffr**. [Check them out here](https://github.com/search?q=cffr%20path%3A**%2FCITATION.cff&type=code). @@ -144,6 +144,9 @@ test <- cff_create("rmarkdown") license: GPL-3.0-only title: 'rmarkdown: Dynamic Documents for R' version: '2.27' + identifiers: + - type: doi + value: 10.32614/CRAN.package.rmarkdown abstract: Convert R Markdown documents into a variety of formats. authors: - family-names: Allaire @@ -300,6 +303,7 @@ test <- cff_create("rmarkdown") email: garrick@posit.co orcid: https://orcid.org/0000-0002-7111-0077 year: '2024' + doi: 10.32614/CRAN.package.bslib version: '>= 0.2.5.1' - type: software title: evaluate @@ -316,6 +320,7 @@ test <- cff_create("rmarkdown") given-names: Yihui orcid: https://orcid.org/0000-0003-0645-5666 year: '2024' + doi: 10.32614/CRAN.package.evaluate version: '>= 0.13' - type: software title: fontawesome @@ -329,6 +334,7 @@ test <- cff_create("rmarkdown") email: rich@posit.co orcid: https://orcid.org/0000-0003-3925-190X year: '2024' + doi: 10.32614/CRAN.package.fontawesome version: '>= 0.5.0' - type: software title: htmltools @@ -358,6 +364,7 @@ test <- cff_create("rmarkdown") - family-names: Allen given-names: Jeff year: '2024' + doi: 10.32614/CRAN.package.htmltools version: '>= 0.5.1' - type: software title: jquerylib @@ -373,6 +380,7 @@ test <- cff_create("rmarkdown") given-names: Joe email: joe@rstudio.com year: '2024' + doi: 10.32614/CRAN.package.jquerylib - type: software title: jsonlite abstract: 'jsonlite: A Simple and Robust JSON Parser and Generator for R' @@ -388,6 +396,7 @@ test <- cff_create("rmarkdown") identifiers: - type: url value: https://arxiv.org/abs/1403.2805 + doi: 10.32614/CRAN.package.jsonlite - type: software title: knitr abstract: 'knitr: A General-Purpose Package for Dynamic Report Generation in R' @@ -400,6 +409,7 @@ test <- cff_create("rmarkdown") email: xie@yihui.name orcid: https://orcid.org/0000-0003-0645-5666 year: '2024' + doi: 10.32614/CRAN.package.knitr version: '>= 1.43' - type: software title: methods @@ -411,6 +421,7 @@ test <- cff_create("rmarkdown") name: R Foundation for Statistical Computing address: Vienna, Austria year: '2024' + doi: 10.32614/CRAN.package.methods - type: software title: tinytex abstract: 'tinytex: Helper Functions to Install and Maintain TeX Live, and Compile @@ -424,6 +435,7 @@ test <- cff_create("rmarkdown") email: xie@yihui.name orcid: https://orcid.org/0000-0003-0645-5666 year: '2024' + doi: 10.32614/CRAN.package.tinytex version: '>= 0.31' - type: software title: tools @@ -435,6 +447,7 @@ test <- cff_create("rmarkdown") name: R Foundation for Statistical Computing address: Vienna, Austria year: '2024' + doi: 10.32614/CRAN.package.tools - type: software title: utils abstract: 'R: A Language and Environment for Statistical Computing' @@ -445,6 +458,7 @@ test <- cff_create("rmarkdown") name: R Foundation for Statistical Computing address: Vienna, Austria year: '2024' + doi: 10.32614/CRAN.package.utils - type: software title: xfun abstract: 'xfun: Supporting Functions for Packages Maintained by ''Yihui Xie''' @@ -457,6 +471,7 @@ test <- cff_create("rmarkdown") email: xie@yihui.name orcid: https://orcid.org/0000-0003-0645-5666 year: '2024' + doi: 10.32614/CRAN.package.xfun version: '>= 0.36' - type: software title: yaml @@ -491,6 +506,7 @@ test <- cff_create("rmarkdown") - family-names: Kamvar given-names: Zhian N. year: '2024' + doi: 10.32614/CRAN.package.yaml version: '>= 2.1.19' - type: software title: digest @@ -552,6 +568,7 @@ test <- cff_create("rmarkdown") - family-names: Chirico. given-names: Michael year: '2024' + doi: 10.32614/CRAN.package.digest - type: software title: dygraphs abstract: 'dygraphs: Interface to ''Dygraphs'' Interactive Time Series Charting @@ -572,6 +589,7 @@ test <- cff_create("rmarkdown") - family-names: Thieurmel given-names: Benoit year: '2024' + doi: 10.32614/CRAN.package.dygraphs - type: software title: fs abstract: 'fs: Cross-Platform File System Operations Based on ''libuv''' @@ -588,6 +606,7 @@ test <- cff_create("rmarkdown") given-names: Gábor email: csardi.gabor@gmail.com year: '2024' + doi: 10.32614/CRAN.package.fs - type: software title: rsconnect abstract: 'rsconnect: Deploy Docs, Apps, and APIs to ''Posit Connect'', ''shinyapps.io'', @@ -608,6 +627,7 @@ test <- cff_create("rmarkdown") - family-names: Allaire given-names: JJ year: '2024' + doi: 10.32614/CRAN.package.rsconnect - type: software title: downlit abstract: 'downlit: Syntax Highlighting and Automatic Linking' @@ -619,6 +639,7 @@ test <- cff_create("rmarkdown") given-names: Hadley email: hadley@posit.co year: '2024' + doi: 10.32614/CRAN.package.downlit version: '>= 0.4.0' - type: software title: katex @@ -632,6 +653,7 @@ test <- cff_create("rmarkdown") email: jeroen@berkeley.edu orcid: https://orcid.org/0000-0002-4035-0289 year: '2024' + doi: 10.32614/CRAN.package.katex version: '>= 1.4.0' - type: software title: sass @@ -659,6 +681,7 @@ test <- cff_create("rmarkdown") email: carson@rstudio.com orcid: https://orcid.org/0000-0002-4958-2844 year: '2024' + doi: 10.32614/CRAN.package.sass version: '>= 0.4.0' - type: software title: shiny @@ -698,6 +721,7 @@ test <- cff_create("rmarkdown") - family-names: Borges given-names: Barbara year: '2024' + doi: 10.32614/CRAN.package.shiny version: '>= 1.6.0' - type: software title: testthat @@ -710,6 +734,7 @@ test <- cff_create("rmarkdown") given-names: Hadley email: hadley@posit.co year: '2024' + doi: 10.32614/CRAN.package.testthat version: '>= 3.0.3' - type: software title: tibble @@ -726,6 +751,7 @@ test <- cff_create("rmarkdown") given-names: Hadley email: hadley@rstudio.com year: '2024' + doi: 10.32614/CRAN.package.tibble - type: software title: vctrs abstract: 'vctrs: Vector Helpers' @@ -743,6 +769,7 @@ test <- cff_create("rmarkdown") given-names: Davis email: davis@posit.co year: '2024' + doi: 10.32614/CRAN.package.vctrs - type: software title: cleanrmd abstract: 'cleanrmd: Clean Class-Less ''R Markdown'' HTML Documents' @@ -755,6 +782,7 @@ test <- cff_create("rmarkdown") email: garrick@adenbuie.com orcid: https://orcid.org/0000-0002-7111-0077 year: '2024' + doi: 10.32614/CRAN.package.cleanrmd - type: software title: withr abstract: 'withr: Run Code ''With'' Temporarily Modified Global State' @@ -779,6 +807,7 @@ test <- cff_create("rmarkdown") - family-names: Chang given-names: Winston year: '2024' + doi: 10.32614/CRAN.package.withr version: '>= 2.4.2' - type: software title: xml2 @@ -795,6 +824,7 @@ test <- cff_create("rmarkdown") - family-names: Ooms given-names: Jeroen year: '2024' + doi: 10.32614/CRAN.package.xml2

diff --git a/codemeta.json b/codemeta.json index 35dd298..12a68db 100644 --- a/codemeta.json +++ b/codemeta.json @@ -200,7 +200,7 @@ }, "isPartOf": "https://ropensci.org", "keywords": ["attribution", "citation", "credit", "citation-files", "cff", "metadata", "r", "r-package", "citation-file-format", "rstats", "ropensci", "cran"], - "fileSize": "1602.502KB", + "fileSize": "1606.15KB", "citation": [ { "@type": "ScholarlyArticle", diff --git a/man/cff.Rd b/man/cff.Rd index 52807df..98a704c 100644 --- a/man/cff.Rd +++ b/man/cff.Rd @@ -35,19 +35,19 @@ Valid parameters are those specified on \code{\link[=cff_schema_keys]{cff_schema \item \code{title} \item \code{version} \item \code{doi} +\item \code{identifiers} \item \code{abstract} \item \code{authors} \item \code{preferred-citation} \item \code{repository} \item \code{repository-artifact} \item \code{repository-code} +\item \code{commit} \item \code{url} \item \code{date-released} \item \code{contact} \item \code{keywords} \item \code{references} -\item \code{commit} -\item \code{identifiers} \item \code{license-url} } } diff --git a/tests/testthat/_snaps/cff.md b/tests/testthat/_snaps/cff.md index ee02298..b6991b3 100644 --- a/tests/testthat/_snaps/cff.md +++ b/tests/testthat/_snaps/cff.md @@ -867,6 +867,15 @@ title: A new title version: 1.0.0 doi: 10.5281/zenodo.1003150 + identifiers: + - type: doi + value: 10.5281/zenodo.1003150 + - type: swh + value: swh:1:rel:99f6850374dc6597af01bd0ee1d3fc0699301b9f + - type: url + value: https://example.com + - type: other + value: other-schema://abcd.1234.efgh.5678 abstract: This is an awesome piece of research software! authors: - family-names: Real Person @@ -1273,6 +1282,7 @@ repository: https://www.example.com/foo/?bar=baz&inga=42&quux repository-artifact: https://files.pythonhosted.org/packages/0a/84/10507b69a07768bc16981184b4d147a0fc84b71fbf35c03bafc8dcced8e1/cffconvert-1.3.3.tar.gz repository-code: http://foo.com/blah_(wikipedia)_blah#cite-1 + commit: 156a04c74a8a79d40c5d705cddf9d36735feab4d url: http://userid:password@example.com:8080/ date-released: '2017-12-11' contact: @@ -1682,16 +1692,6 @@ date-start: '2017-01-01' date-end: '2017-01-31' location: The team garage - commit: 156a04c74a8a79d40c5d705cddf9d36735feab4d - identifiers: - - type: doi - value: 10.5281/zenodo.1003150 - - type: swh - value: swh:1:rel:99f6850374dc6597af01bd0ee1d3fc0699301b9f - - type: url - value: https://example.com - - type: other - value: other-schema://abcd.1234.efgh.5678 license-url: https://spdx.org/licenses/CC-BY-SA-4.0.html#licenseText # Recursive parsing diff --git a/tests/testthat/_snaps/cff_create.md b/tests/testthat/_snaps/cff_create.md index d4b01e8..9d94f0e 100644 --- a/tests/testthat/_snaps/cff_create.md +++ b/tests/testthat/_snaps/cff_create.md @@ -32,6 +32,9 @@ license: GPL-2.0-or-later title: 'rgeos: Interface to Geometry Engine - Open Source (''GEOS'')' version: 0.5-7 + identifiers: + - type: url + value: http://rgeos.r-forge.r-project.org/index.html abstract: 'Interface to Geometry Engine - Open Source (''GEOS'') using the C ''API'' for topology operations on geometries. Please note that ''rgeos'' will be retired by the end of 2023, plan transition to sf functions using ''GEOS'' at your earliest @@ -66,9 +69,6 @@ given-names: Roger email: Roger.Bivand@nhh.no orcid: https://orcid.org/0000-0003-2392-6140 - identifiers: - - type: url - value: http://rgeos.r-forge.r-project.org/index.html --- @@ -126,6 +126,9 @@ license: GPL-2.0-or-later title: 'rgeos: Interface to Geometry Engine - Open Source (''GEOS'')' version: 0.5-7 + identifiers: + - type: url + value: http://rgeos.r-forge.r-project.org/index.html abstract: 'Interface to Geometry Engine - Open Source (''GEOS'') using the C ''API'' for topology operations on geometries. Please note that ''rgeos'' will be retired by the end of 2023, plan transition to sf functions using ''GEOS'' at your earliest @@ -160,9 +163,6 @@ given-names: Roger email: Roger.Bivand@nhh.no orcid: https://orcid.org/0000-0003-2392-6140 - identifiers: - - type: url - value: http://rgeos.r-forge.r-project.org/index.html # Coerce date in another format @@ -199,6 +199,13 @@ license: GPL-3.0-only title: 'manyurls: A lot of urls' version: 0.1.6 + identifiers: + - type: url + value: https://r-forge.r-project.org/projects/test/ + - type: url + value: http://google.ru + - type: url + value: https://gitlab.com/r-packages/behaviorchange abstract: This package has many urls. Specifically, 1 Bug Reports and 6 URLs. Expected is to have 1 repository-code, 1 url and 3 URLs, since there is 1 duplicate and 1 invalid url. @@ -212,13 +219,6 @@ - family-names: Basic given-names: Marc email: marcbasic@gmail.com - identifiers: - - type: url - value: https://r-forge.r-project.org/projects/test/ - - type: url - value: http://google.ru - - type: url - value: https://gitlab.com/r-packages/behaviorchange # Parsing Gitlab @@ -231,6 +231,7 @@ license: GPL-3.0-only title: 'codemetar: Generate ''CodeMeta'' Metadata for R Packages' version: 0.1.6 + doi: 10.32614/CRAN.package.codemetar abstract: The 'Codemeta' Project defines a 'JSON-LD' format for describing software metadata, as detailed at . This package provides utilities to generate, parse, and modify 'codemeta.json' files automatically for R packages, @@ -315,6 +316,11 @@ license: MIT title: 'wrongurls: Generate CodeMeta Metadata for R Packages' version: 0.1.0 + identifiers: + - type: url + value: https://httpbin.org/status/429 + - type: url + value: https://www.github.es/ropensci/codemeta abstract: Codemeta defines a 'JSON-LD' format for describing software metadata. This package provides utilities to generate, parse, and modify codemeta.jsonld files automatically for R packages. @@ -336,11 +342,6 @@ - citation - credit - linked-data - identifiers: - - type: url - value: https://httpbin.org/status/429 - - type: url - value: https://www.github.es/ropensci/codemeta # Parsing two maintainers @@ -353,6 +354,7 @@ license: GPL-3.0-only title: 'codemetar: Generate ''CodeMeta'' Metadata for R Packages' version: 0.1.6 + doi: 10.32614/CRAN.package.codemetar abstract: The 'Codemeta' Project defines a 'JSON-LD' format for describing software metadata, as detailed at . This package provides utilities to generate, parse, and modify 'codemeta.json' files automatically for R packages, @@ -388,6 +390,7 @@ license: GPL-3.0-only title: 'codemetar: Generate ''CodeMeta'' Metadata for R Packages' version: 0.3.5 + doi: 10.32614/CRAN.package.codemetar abstract: The 'Codemeta' Project defines a 'JSON-LD' format for describing software metadata, as detailed at . This package provides utilities to generate, parse, and modify 'codemeta.json' files automatically for R packages, @@ -402,6 +405,7 @@ orcid: https://orcid.org/0000-0002-2815-0399 repository: https://ropensci.r-universe.dev repository-code: https://github.com/ropensci/codemetar + commit: bdd9a29d7eabcc43c3195fe461f884932eba763c url: https://docs.ropensci.org/codemetar/ date-released: '2024-02-09' contact: @@ -416,7 +420,6 @@ - citation - credit - linked-data - commit: bdd9a29d7eabcc43c3195fe461f884932eba763c # Parsing Bioconductor @@ -465,6 +468,7 @@ license: MIT title: 'resmush: Optimize and Compress Image Files with ''reSmush.it''' version: 0.1.0 + doi: 10.32614/CRAN.package.resmush abstract: Compress local and online images using the 'reSmush.it' API service . authors: - family-names: Hernangómez @@ -498,6 +502,7 @@ license: GPL-3.0-only title: 'ggplot2: A Basic Description' version: 0.1.6 + doi: 10.32614/CRAN.package.ggplot2 abstract: A very basic description. Should parse without problems. authors: - family-names: Basic diff --git a/tests/testthat/_snaps/cff_read.md b/tests/testthat/_snaps/cff_read.md index afd28fc..3d8ccee 100644 --- a/tests/testthat/_snaps/cff_read.md +++ b/tests/testthat/_snaps/cff_read.md @@ -87,6 +87,7 @@ title: 'surveillance: Temporal and Spatio-Temporal Modeling and Monitoring of Epidemic Phenomena' version: 1.19.1 + doi: 10.32614/CRAN.package.surveillance abstract: Statistical methods for the modeling and monitoring of time series of counts, proportions and categorical data, as well as for the modeling of continuous-time point processes of epidemic phenomena. The monitoring methods focus on aberration diff --git a/tests/testthat/_snaps/mock-package.md b/tests/testthat/_snaps/mock-package.md index 75458a3..7b03744 100644 --- a/tests/testthat/_snaps/mock-package.md +++ b/tests/testthat/_snaps/mock-package.md @@ -10,6 +10,13 @@ title: 'manyurls: A lot of urls' version: 0.1.6 doi: 10.1111/2041-210X.12469 + identifiers: + - type: url + value: https://r-forge.r-project.org/projects/test/ + - type: url + value: http://google.ru + - type: url + value: https://gitlab.com/r-packages/behaviorchange abstract: This package has many urls. Specifically, 1 Bug Reports and 6 URLs. Expected is to have 1 repository-code, 1 url and 3 URLs, since there is 1 duplicate and 1 invalid url. @@ -53,13 +60,6 @@ year: '2016' isbn: 978-3-319-24277-4 url: https://ggplot2.tidyverse.org - identifiers: - - type: url - value: https://r-forge.r-project.org/projects/test/ - - type: url - value: http://google.ru - - type: url - value: https://gitlab.com/r-packages/behaviorchange --- diff --git a/tests/testthat/_snaps/utils-create.md b/tests/testthat/_snaps/utils-create.md index c1bcbb8..e6367ef 100644 --- a/tests/testthat/_snaps/utils-create.md +++ b/tests/testthat/_snaps/utils-create.md @@ -286,6 +286,9 @@ doi: 10.1111/2041-210X.12469 start: '352' end: '357' + identifiers: + - type: doi + value: 10.32614/CRAN.package.codemetar references: - type: book title: 'ggplot2: Elegant Graphics for Data Analysis' @@ -493,6 +496,9 @@ doi: 10.1111/2041-210X.12469 start: '352' end: '357' + identifiers: + - type: doi + value: 10.32614/CRAN.package.codemetar references: - type: book title: 'ggplot2: Elegant Graphics for Data Analysis' @@ -614,6 +620,9 @@ doi: 10.1111/2041-210X.12469 start: '352' end: '357' + identifiers: + - type: doi + value: 10.32614/CRAN.package.resmush references: - type: book title: 'ggplot2: Elegant Graphics for Data Analysis' @@ -686,6 +695,9 @@ doi: 10.1111/2041-210X.12469 start: '352' end: '357' + identifiers: + - type: doi + value: 10.32614/CRAN.package.codemetar references: - type: book title: 'ggplot2: Elegant Graphics for Data Analysis' @@ -854,6 +866,9 @@ doi: 10.1111/2041-210X.12469 start: '352' end: '357' + identifiers: + - type: doi + value: 10.32614/CRAN.package.surveillance references: - type: book title: 'ggplot2: Elegant Graphics for Data Analysis' @@ -921,6 +936,9 @@ doi: 10.1111/2041-210X.12469 start: '352' end: '357' + identifiers: + - type: doi + value: 10.32614/CRAN.package.MomTrunc references: - type: book title: 'ggplot2: Elegant Graphics for Data Analysis' @@ -987,6 +1005,9 @@ doi: 10.1111/2041-210X.12469 start: '352' end: '357' + identifiers: + - type: doi + value: 10.32614/CRAN.package.codemetar references: - type: book title: 'ggplot2: Elegant Graphics for Data Analysis' diff --git a/tests/testthat/_snaps/utils-schema.md b/tests/testthat/_snaps/utils-schema.md index 40b2ea7..c2dc41d 100644 --- a/tests/testthat/_snaps/utils-schema.md +++ b/tests/testthat/_snaps/utils-schema.md @@ -5,9 +5,9 @@ Output [1] "cff-version" "message" "type" [4] "license" "title" "version" - [7] "doi" "abstract" "authors" - [10] "preferred-citation" "repository" "repository-artifact" - [13] "repository-code" "url" "date-released" - [16] "contact" "keywords" "references" - [19] "commit" "identifiers" "license-url" + [7] "doi" "identifiers" "abstract" + [10] "authors" "preferred-citation" "repository" + [13] "repository-artifact" "repository-code" "commit" + [16] "url" "date-released" "contact" + [19] "keywords" "references" "license-url" diff --git a/vignettes/crosswalk.Rmd b/vignettes/crosswalk.Rmd index c70ff9e..009cee7 100644 --- a/vignettes/crosswalk.Rmd +++ b/vignettes/crosswalk.Rmd @@ -270,7 +270,9 @@ cat(cff_create(tmp)$`date-released`) ### doi {#doi} This key is coerced from the `"doi"` field of the -[preferred-citation](#preferred-citation) object. +[preferred-citation](#preferred-citation) object. If not present and the package +is on **CRAN**, it would be populated with the doi provided by **CRAN** (e.g. +).

@@ -299,6 +301,9 @@ This key includes all the possible identifiers of the package: [doi](#doi) and the identifiers (if any) not included in the `"identifiers"` key of [preferred-citation](#preferred-citation). +- If the package is on **CRAN** and it has a `CITATION` file providing a doi, + the doi provided by **CRAN** would be added as well. +
Example