From ac3845e62a522a1a2c6c59296a63b2223f17b83e Mon Sep 17 00:00:00 2001 From: Diego H Date: Fri, 9 Aug 2024 16:52:46 +0200 Subject: [PATCH] Adapt to changes in person (R 4.5.0) --- CITATION.cff | 5 +- DESCRIPTION | 2 +- NEWS.md | 4 ++ R/as_cff_person.R | 12 +++- R/utils-persons.R | 5 ++ README.Rmd | 2 +- README.md | 80 ++------------------------ codemeta.json | 6 +- data/cran_to_spdx.rda | Bin 912 -> 943 bytes inst/schemaorg.json | 4 +- man/cff_class.Rd | 12 ++-- tests/testthat/_snaps/cff_create.md | 2 - tests/testthat/_snaps/methods.md | 6 +- tests/testthat/_snaps/utils-create.md | 2 - tests/testthat/test-cff_create.R | 4 ++ tests/testthat/test-methods.R | 4 ++ tests/testthat/test-utils-create.R | 4 ++ 17 files changed, 54 insertions(+), 100 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index 2d9289e8..d2bc655e 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -8,7 +8,7 @@ message: 'To cite package "cffr" in publications use:' type: software license: GPL-3.0-or-later title: 'cffr: Generate Citation File Format (''cff'') Metadata for R Packages' -version: 1.1.0 +version: 1.1.0.9000 doi: 10.21105/joss.03900 identifiers: - type: doi @@ -143,9 +143,6 @@ references: email: jeroen@berkeley.edu orcid: https://orcid.org/0000-0002-4035-0289 year: '2024' - identifiers: - - type: url - value: https://arxiv.org/abs/1403.2805 doi: 10.32614/CRAN.package.jsonlite version: '>= 1.7.2' - type: software diff --git a/DESCRIPTION b/DESCRIPTION index cf64c614..db23ce79 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: cffr Title: Generate Citation File Format ('cff') Metadata for R Packages -Version: 1.1.0 +Version: 1.1.0.9000 Authors@R: c( person("Diego", "Hernangómez", , "diego.hernangomezherrero@gmail.com", role = c("aut", "cre", "cph"), comment = c(ORCID = "0000-0001-8457-4658")), diff --git a/NEWS.md b/NEWS.md index e63b3f9a..ea4391cf 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# cffr (development version) + +- Adapt extraction of orcid to **R \> 4.4.1**. + # cffr 1.1.0 - Now **cffr** adds automatically dois to packages on **CRAN** (e.g. diff --git a/R/as_cff_person.R b/R/as_cff_person.R index ec759564..edfa35da 100644 --- a/R/as_cff_person.R +++ b/R/as_cff_person.R @@ -170,7 +170,8 @@ as_cff_person <- function(x, ...) { #' @rdname as_cff_person #' @order 2 as_cff_person.default <- function(x, ...) { - x <- clean_str(x) + # Check if this is protected + if (!inherits(x, "Bibtex")) x <- clean_str(x) if (is.null(x)) { return(NULL) } @@ -197,7 +198,14 @@ as_cff_person.person <- function(x, ...) { #' @rdname as_cff_person #' @order 4 as_cff_person.character <- function(x, ...) { - test_x <- clean_str(x) + # Maybe is protected ... + if (any(grepl("{", x, fixed = TRUE))) { + test_x <- x + } else { + test_x <- clean_str(x) + } + + if (is.null(test_x)) { return(NULL) } diff --git a/R/utils-persons.R b/R/utils-persons.R index ee52d45b..14a5d273 100644 --- a/R/utils-persons.R +++ b/R/utils-persons.R @@ -360,6 +360,11 @@ extract_person_comments <- function(person) { # guess orcid orcid <- url_comment[grepl("orcid.org/", url_comment)] + # Case for R > 4.4.1 + if ("orcid" %in% names(comm_cff)) { + orcid <- clean_str(comm_cff$orcid) + } + # Get the first non-orcid url web <- url_comment[!grepl("orcid.org/", url_comment)][1] diff --git a/README.Rmd b/README.Rmd index 6b53a895..deaea65e 100644 --- a/README.Rmd +++ b/README.Rmd @@ -63,7 +63,7 @@ knitr::include_graphics("vignettes/tweet-1.png") *--- Nat Friedman (\@natfriedman) July 27, 2021* See [Enhanced support for citations on -GitHub](https://github.blog/2021-08-19-enhanced-support-citations-github/) +GitHub](https://github.blog/news-insights/company-news/enhanced-support-citations-github/) [@smith2021] for more info. ### Related projects diff --git a/README.md b/README.md index f89cdecd..cbd2b86c 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ interest: *— Nat Friedman (@natfriedman) July 27, 2021* See [Enhanced support for citations on -GitHub](https://github.blog/2021-08-19-enhanced-support-citations-github/) +GitHub](https://github.blog/news-insights/company-news/enhanced-support-citations-github/) ([Smith 2021](#ref-smith2021)) for more info. ### Related projects @@ -73,7 +73,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-07-23 there are at least 290 repos on GitHub using **cffr**. +As per 2024-08-09 there are at least 290 repos on GitHub using **cffr**. [Check them out here](https://github.com/search?q=cffr%20path%3A**%2FCITATION.cff&type=code). @@ -229,6 +229,7 @@ test <- cff_create("rmarkdown") url: https://github.com/rstudio/rmarkdown repository: https://CRAN.R-project.org/package=rmarkdown repository-code: https://github.com/rstudio/rmarkdown + commit: '2.27' url: https://pkgs.rstudio.com/rmarkdown/ date-released: '2024-05-17' contact: @@ -394,9 +395,6 @@ test <- cff_create("rmarkdown") email: jeroen@berkeley.edu orcid: https://orcid.org/0000-0002-4035-0289 year: '2024' - identifiers: - - type: url - value: https://arxiv.org/abs/1403.2805 doi: 10.32614/CRAN.package.jsonlite - type: software title: knitr @@ -572,27 +570,6 @@ test <- cff_create("rmarkdown") given-names: Michael year: '2024' doi: 10.32614/CRAN.package.digest - - type: software - title: dygraphs - abstract: 'dygraphs: Interface to ''Dygraphs'' Interactive Time Series Charting - Library' - notes: Suggests - url: https://github.com/rstudio/dygraphs - repository: https://CRAN.R-project.org/package=dygraphs - authors: - - family-names: Vanderkam - given-names: Dan - website: http://dygraphs.com/ - - family-names: Allaire - given-names: JJ - - family-names: Owen - given-names: Jonathan - - family-names: Gromer - given-names: Daniel - - 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''' @@ -610,27 +587,6 @@ test <- cff_create("rmarkdown") 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'', - and ''RPubs''' - notes: Suggests - url: https://rstudio.github.io/rsconnect/ - repository: https://CRAN.R-project.org/package=rsconnect - authors: - - family-names: Atkins - given-names: Aron - email: aron@posit.co - - family-names: Allen - given-names: Toph - - family-names: Wickham - given-names: Hadley - - family-names: McPherson - given-names: Jonathan - - 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' @@ -644,20 +600,6 @@ test <- cff_create("rmarkdown") year: '2024' doi: 10.32614/CRAN.package.downlit version: '>= 0.4.0' - - type: software - title: katex - abstract: 'katex: Rendering Math to HTML, ''MathML'', or R-Documentation Format' - notes: Suggests - url: https://docs.ropensci.org/katex/ - repository: https://CRAN.R-project.org/package=katex - authors: - - family-names: Ooms - given-names: Jeroen - 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 abstract: 'sass: Syntactically Awesome Style Sheets (''Sass'')' @@ -773,19 +715,6 @@ test <- cff_create("rmarkdown") 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' - notes: Suggests - url: https://pkg.garrickadenbuie.com/cleanrmd/ - repository: https://CRAN.R-project.org/package=cleanrmd - authors: - - family-names: Aden-Buie - given-names: Garrick - 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' @@ -937,7 +866,8 @@ for more info. ## References -
+
diff --git a/codemeta.json b/codemeta.json index 0fb0c41e..9b00f306 100644 --- a/codemeta.json +++ b/codemeta.json @@ -8,13 +8,13 @@ "codeRepository": "https://github.com/ropensci/cffr", "issueTracker": "https://github.com/ropensci/cffr/issues", "license": "https://spdx.org/licenses/GPL-3.0", - "version": "1.1.0", + "version": "1.1.0.9000", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", "url": "https://r-project.org" }, - "runtimePlatform": "R version 4.4.1 (2024-06-14)", + "runtimePlatform": "R Under development (unstable) (2024-08-07 r86984 ucrt)", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -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": "1604.704KB", + "fileSize": "1623.607KB", "citation": [ { "@type": "ScholarlyArticle", diff --git a/data/cran_to_spdx.rda b/data/cran_to_spdx.rda index 2555f3172aeb92f84a95a5654eebdb238766e1ac..91770a2e23ddf93672dac1188746557885a13e31 100644 GIT binary patch literal 943 zcmV;g15o@QiwFP!000002F+L9Z__Xk4@ZK;kJwJZuuK)`ao2R_d}+RZ6Cc zGBjSOvd$Bc(sWAF@$tmp!XL_TnmGQ5-EIN_4^4f)``NxbpYM{lC+CKCt|^MLqLfzA zQ$@ql3VJ+HN=gO&SI40njN<7iy1x9PDC*-mS5fNd_c7zB9m~mvrA}{PXXA&-Sl?^6 zbaOw0))EMqnY7WlcE_KfZhK=GL@+~lSXAF@wR8h7@KmI19PG>HwinH9Gjq2%HBx1o zXPo9e3?pwEP>k(P7<*CdjRmu-SO+Nn@$f`9z}Rb#$ zd4?AM{tmyg2|)EehMj7#MbnR0dNm3lG;UX!UKpZ!MMBBUn#CU}Ump zbyK;~%#dAcI+>u@4rUiV6;2#-;)rGqxW&r|p*($Uh0u+?8>pvCMtUcXL+@f1Ckr7D z^nMV-FmMyu^|?r^-8_%0-E5~ONtROgEZ5hP@jMfojpjZJwxuA6Ndh9faRkb5LI}~B z;(+u{&-BjK6%40(4+bzqrn14oS(*?RGIr$*Hj>MT`F(z|fOvy%$vwCxZGa7<2!@MY zQc1bd=GEqia-*6fX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#9XOc6W19PMfg}KgNnEM7pAN8Mts)ID mhAQF-izYuBJ6I6ezo=&C@&qU!kM~qZ{}*yaI8cyv^=}IoZjqP( diff --git a/inst/schemaorg.json b/inst/schemaorg.json index 4c9f2e21..0c2ca89c 100644 --- a/inst/schemaorg.json +++ b/inst/schemaorg.json @@ -26,6 +26,6 @@ "name": "Comprehensive R Archive Network (CRAN)", "url": "https://cran.r-project.org" }, - "runtimePlatform": "R version 4.4.1 (2024-06-14)", - "version": "1.1.0" + "runtimePlatform": "R Under development (unstable) (2024-08-07 r86984 ucrt)", + "version": "1.1.0.9000" } diff --git a/man/cff_class.Rd b/man/cff_class.Rd index af0a4c1b..68026d55 100644 --- a/man/cff_class.Rd +++ b/man/cff_class.Rd @@ -162,8 +162,9 @@ ref_list #> - family-names: Gao #> given-names: Charlie #> year: '2024' -#> notes: R package version 2.3.9 -#> url: https://github.com/vubiostat/r-yaml/ +#> notes: R package version 2.3.10 +#> url: https://CRAN.R-project.org/package=yaml +#> doi: 10.32614/CRAN.package.yaml class(ref_list) #> [1] "cff_ref_lst" "cff" @@ -336,13 +337,14 @@ toBibtex(cit) #> title = \{yaml: Methods to Convert R Data to YAML and Back\}, #> author = \{Shawn P Garbett and Jeremy Stephens and Kirill Simonov and Yihui Xie and Zhuoer Dong and Hadley Wickham and Jeffrey Horner and \{reikoch\} and Will Beasley and Brendan O'Connor and Gregory R. Warnes and Michael Quinn and Zhian N. Kamvar and Charlie Gao\}, #> year = \{2024\}, -#> note = \{R package version 2.3.9\}, -#> url = \{https://github.com/vubiostat/r-yaml/\}, +#> note = \{R package version 2.3.10\}, +#> url = \{https://CRAN.R-project.org/package=yaml\}, +#> doi = \{10.32614/CRAN.package.yaml\}, #> \} # cff_pers, cff_pers_lst toBibtex(two_persons) -#> [1] "person, A and \{An entity\}" +#> person, A and \{An entity\} }\if{html}{\out{
}} } diff --git a/tests/testthat/_snaps/cff_create.md b/tests/testthat/_snaps/cff_create.md index 9d94f0e7..6578e1ae 100644 --- a/tests/testthat/_snaps/cff_create.md +++ b/tests/testthat/_snaps/cff_create.md @@ -328,13 +328,11 @@ - family-names: Boettiger given-names: Carl email: cboettig@gmail.com - orcid: https://orcid.org/0000-0002-1642-628X url: https://httpbin.org/status/404 contact: - family-names: Boettiger given-names: Carl email: cboettig@gmail.com - orcid: https://orcid.org/0000-0002-1642-628X keywords: - metadata - codemeta diff --git a/tests/testthat/_snaps/methods.md b/tests/testthat/_snaps/methods.md index 1bd0b5ad..eb195458 100644 --- a/tests/testthat/_snaps/methods.md +++ b/tests/testthat/_snaps/methods.md @@ -1109,19 +1109,19 @@ Code toBibtex(sev_auth) Output - [1] "{The Big Bopper} and Sinatra, Frank and Martin, Dean and Davis, Jr., Sammy" + {The Big Bopper} and Sinatra, Frank and Martin, Dean and Davis, Jr., Sammy --- Code toBibtex(single) Output - [1] "person, A" + person, A --- Code toBibtex(single) Output - [1] "{A and B co}" + {A and B co} diff --git a/tests/testthat/_snaps/utils-create.md b/tests/testthat/_snaps/utils-create.md index e6367eff..0c356ee3 100644 --- a/tests/testthat/_snaps/utils-create.md +++ b/tests/testthat/_snaps/utils-create.md @@ -1034,7 +1034,6 @@ - family-names: Boettiger given-names: Carl email: cboettig@gmail.com - orcid: https://orcid.org/0000-0002-1642-628X 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. @@ -1043,7 +1042,6 @@ - family-names: Boettiger given-names: Carl email: cboettig@gmail.com - orcid: https://orcid.org/0000-0002-1642-628X keywords: - metadata - codemeta diff --git a/tests/testthat/test-cff_create.R b/tests/testthat/test-cff_create.R index a4f8093b..e679ebfc 100644 --- a/tests/testthat/test-cff_create.R +++ b/tests/testthat/test-cff_create.R @@ -295,6 +295,10 @@ test_that("Parsing many persons", { test_that("Parsing wrong urls", { + rvers <- getRversion() + skip_if(rvers <= "4.4.1", "Snapshot created with R 4.5.0") + skip_on_cran() + desc_path <- system.file("examples/DESCRIPTION_wrong_urls", package = "cffr") a_cff <- cff_create(desc_path, diff --git a/tests/testthat/test-methods.R b/tests/testthat/test-methods.R index ba0d9e4e..36a19e52 100644 --- a/tests/testthat/test-methods.R +++ b/tests/testthat/test-methods.R @@ -189,6 +189,7 @@ test_that("as.person method", { }) test_that("as.person method names and particles", { + skip_on_cran() str <- "von Wicksteed, III, P. H. and {The translator factory}" cf <- as_cff_person(str) @@ -227,6 +228,9 @@ test_that("head and tail", { }) test_that("toBibtex", { + rvers <- getRversion() + skip_if(rvers <= "4.4.1", "Snapshot created with R 4.5.0") + # Create several alternatives descobj <- cff_read_description(system.file("examples/DESCRIPTION_basic", package = "cffr" diff --git a/tests/testthat/test-utils-create.R b/tests/testthat/test-utils-create.R index b69c295c..62b02e6a 100644 --- a/tests/testthat/test-utils-create.R +++ b/tests/testthat/test-utils-create.R @@ -1,4 +1,8 @@ test_that("Merge all DESCRIPTION files with CITATION_basic", { + rvers <- getRversion() + skip_if(rvers <= "4.4.1", "Snapshot created with R 4.5.0") + skip_on_cran() + allfiles <- list.files( system.file("examples", package = "cffr"), pattern = "^DESC", full.names = TRUE