Skip to content

Commit bc17340

Browse files
committed
doc: future-proof inst/CITATION
1 parent 1d3fd73 commit bc17340

File tree

2 files changed

+6
-43
lines changed

2 files changed

+6
-43
lines changed

README.Rmd

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,45 +9,6 @@ output: md_document
99
![CRAN/METACRAN](https://img.shields.io/cran/l/soilDB)
1010
[![soilDB Manual](https://img.shields.io/badge/docs-HTML-informational)](https://ncss-tech.github.io/soilDB/)
1111

12-
```{r, echo=FALSE, message=FALSE, warning=FALSE}
13-
library(rvest)
14-
# get latest release semantic version number for citation
15-
.getLatestCRANRelease <- function() {
16-
gsub(".*/([0-9\\.]+)$", "\\1", html_text(html_element(html_element(read_html("https://github.com/ncss-tech/soilDB/releases.atom"), "entry"), "id")))
17-
}
18-
19-
.update_CITATION <- function(version) {
20-
x <- sprintf('citHeader("To cite soilDB in publications use:")
21-
22-
bibentry(
23-
bibtype = "Manual",
24-
title = "soilDB: Soil Database Interface",
25-
author = "Dylan Beaudette, Jay Skovlin, Stephen Roecker and Andrew Brown",
26-
note = "R package version %s",
27-
url = "https://CRAN.R-project.org/package=soilDB",
28-
year = "%s",
29-
textVersion = "Beaudette, D., Skovlin, J., Roecker, S., Brown, A. (%s). soilDB: Soil Database Interface. R package version %s. <https://CRAN.R-project.org/package=soilDB>"
30-
)
31-
', version, format(Sys.time(), "%Y"), format(Sys.time(), "%Y"), version)
32-
suppressWarnings(writeLines(strsplit(x, "\n")[[1]], "inst/CITATION"))
33-
}
34-
35-
# get latest tagged release from github
36-
soilDB_CRAN_VERSION <- .getLatestCRANRelease()
37-
38-
# get installed version
39-
soilDB_INSTALLED_VERSION <- packageVersion("soilDB")
40-
41-
# rebuilding readme locally, use installed version
42-
if (soilDB::local_NASIS_defined() && (soilDB_INSTALLED_VERSION > soilDB_CRAN_VERSION)) {
43-
.update_CITATION(soilDB_INSTALLED_VERSION)
44-
} else {
45-
.update_CITATION(soilDB_CRAN_VERSION)
46-
}
47-
48-
# update inst/CITATION
49-
```
50-
5112
## Installation
5213

5314
Get the stable version from CRAN:

inst/CITATION

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ citHeader("To cite soilDB in publications use:")
33
bibentry(
44
bibtype = "Manual",
55
title = "soilDB: Soil Database Interface",
6-
author = "Dylan Beaudette, Jay Skovlin, Stephen Roecker and Andrew Brown",
7-
note = "R package version 2.8.11",
6+
author = c(person(given="Dylan", family="Beaudette"),
7+
person(given="Jay", family="Skovlin"),
8+
person(given="Stephen", family="Roecker"),
9+
person(given="Andrew", family="Brown")),
10+
note = paste("R package version", packageVersion("soilDB")),
811
url = "https://CRAN.R-project.org/package=soilDB",
9-
year = "2025",
10-
textVersion = "Beaudette, D., Skovlin, J., Roecker, S., Brown, A. (2025). soilDB: Soil Database Interface. R package version 2.8.11. <https://CRAN.R-project.org/package=soilDB>"
12+
year = strftime(Sys.Date(), "%Y")
1113
)

0 commit comments

Comments
 (0)