Skip to content

Commit

Permalink
Adapt to changes in person (R 4.5.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
dieghernan committed Aug 9, 2024
1 parent eb85704 commit ac3845e
Show file tree
Hide file tree
Showing 17 changed files with 54 additions and 100 deletions.
5 changes: 1 addition & 4 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -143,9 +143,6 @@ references:
email: [email protected]
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
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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", , "[email protected]", role = c("aut", "cre", "cph"),
comment = c(ORCID = "0000-0001-8457-4658")),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
12 changes: 10 additions & 2 deletions R/as_cff_person.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down
5 changes: 5 additions & 0 deletions R/utils-persons.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 365 in R/utils-persons.R

View check run for this annotation

Codecov / codecov/patch

R/utils-persons.R#L365

Added line #L365 was not covered by tests
}

# Get the first non-orcid url
web <- url_comment[!grepl("orcid.org/", url_comment)][1]

Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
80 changes: 5 additions & 75 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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).

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -394,9 +395,6 @@ test <- cff_create("rmarkdown")
email: [email protected]
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
Expand Down Expand Up @@ -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'''
Expand All @@ -610,27 +587,6 @@ test <- cff_create("rmarkdown")
email: [email protected]
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: [email protected]
- 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'
Expand All @@ -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: [email protected]
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'')'
Expand Down Expand Up @@ -773,19 +715,6 @@ test <- cff_create("rmarkdown")
email: [email protected]
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: [email protected]
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'
Expand Down Expand Up @@ -937,7 +866,8 @@ for more info.

## References

<div id="refs" class="references csl-bib-body hanging-indent">
<div id="refs" class="references csl-bib-body hanging-indent"
entry-spacing="0">

<div id="ref-codemeta" class="csl-entry">

Expand Down
6 changes: 3 additions & 3 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Binary file modified data/cran_to_spdx.rda
Binary file not shown.
4 changes: 2 additions & 2 deletions inst/schemaorg.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
12 changes: 7 additions & 5 deletions man/cff_class.Rd

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

2 changes: 0 additions & 2 deletions tests/testthat/_snaps/cff_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,11 @@
- family-names: Boettiger
given-names: Carl
email: [email protected]
orcid: https://orcid.org/0000-0002-1642-628X
url: https://httpbin.org/status/404
contact:
- family-names: Boettiger
given-names: Carl
email: [email protected]
orcid: https://orcid.org/0000-0002-1642-628X
keywords:
- metadata
- codemeta
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/_snaps/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}

2 changes: 0 additions & 2 deletions tests/testthat/_snaps/utils-create.md
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,6 @@
- family-names: Boettiger
given-names: Carl
email: [email protected]
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.
Expand All @@ -1043,7 +1042,6 @@
- family-names: Boettiger
given-names: Carl
email: [email protected]
orcid: https://orcid.org/0000-0002-1642-628X
keywords:
- metadata
- codemeta
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test-cff_create.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test-utils-create.R
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit ac3845e

Please sign in to comment.