ropensci / cffr

Generate Citation File Format (cff) Metadata for R Packages
https://docs.ropensci.org/cffr/
GNU General Public License v3.0
24 stars 3 forks source link

Is it possible to use cffr offline? #33

Closed jeroen closed 2 years ago

jeroen commented 2 years ago

Thanks for cffr! We are using it in r-universe to generate cff files for all the packages.

One build failed because it seemed github had a network issue at the time:

Generate citation.cff
  citation.cff generated
  Adding  citation.cff to .Rbuildignore
  Error in download.file(jsonschema, schema_temp, mode = "wb", quiet = TRUE) : 
    cannot open URL 'https://raw.githubusercontent.com/citation-file-format/citation-file-format/main/schema.json'
  In addition: Warning message:
  In download.file(jsonschema, schema_temp, mode = "wb", quiet = TRUE) :
    cannot open URL 'https://raw.githubusercontent.com/citation-file-format/citation-file-format/main/schema.json': HTTP status was '503 Service Unavailable'

Is it needed to download this file for every build? Maybe we can include a copy of schema.json in the package, such that it can work offline (given that gh_keywords = FALSE of course)? Or am I missing something?

dieghernan commented 2 years ago

Hi @jeroen, definitely it is not needed, I can store a copy on the extdata folder. It was a decision I made since when developing the package the schema had recent changes (now it has been 8 months since the last one https://github.com/citation-file-format/citation-file-format/commits/main/schema.json so I assume it stable now).

I will prepare a quick fix on this, I would let you know

dieghernan commented 2 years ago

And regarding other online calls, e.g GH Topics, I tried to add mechanism to avoid errors if offline, even when gh_keywords = TRUE"

https://github.com/ropensci/cffr/blob/0a4a9c617e4cc57275acf9f537dde78552a8d55e/R/parse_description.R#L313-L330

dieghernan commented 2 years ago

Dear @jeroen , there is now a new version on CRAN that uses a local copy of the schema, so no more downloads! https://cran.r-project.org/web/packages/cffr/index.html