write out a codemeta.json file for a given package. This function is
basically a wrapper around create_codemeta() to both create the codemeta
object and write it out to a JSON-LD-formatted file in one command. It can
also be used simply to write out to JSON-LD any existing object created with
create_codemeta()
.
write_codemeta(
pkg = ".",
path = "codemeta.json",
root = ".",
id = NULL,
use_filesize = TRUE,
force_update = getOption("codemeta_force_update", TRUE),
use_git_hook = NULL,
verbose = TRUE,
write_minimeta = FALSE,
...
)
writes out the codemeta.json file, and schemaorg.json if write_codemeta
is TRUE
.
package path to package root, or description file (character), or a codemeta object (list)
file name of the output, leave at default "codemeta.json"
if pkg is a codemeta object, optionally give the path to package root. Default guess is current dir.
identifier for the package, e.g. a DOI (or other resolvable URL)
whether to try to estimating and adding a filesize by using
base::file.size()
. Files in .Rbuildignore
are ignored.
Update guessed fields even if they are defined in an existing codemeta.json file
Deprecated argument.
Whether to print messages indicating opinions e.g. when
DESCRIPTION has no URL. -- See give_opinions
;
and indicating the progress of internet downloads.
whether to also create the file schemaorg.json that
corresponds to the metadata Google would validate, to be inserted to a
webpage for SEO. It is saved as "inst/schemaorg.json" alongside path
(by
default, "codemeta.json").
additional arguments to write_json
If pkg is a codemeta object, the function will attempt to update any fields it can guess (i.e. from the DESCRIPTION file), overwriting any existing data in that block. In this case, the package root directory should be the current working directory.
When creating and writing a codemeta.json for the first time, the function adds "codemeta.json" to .Rbuildignore.
if (FALSE) {
# from anywhere in the package source directory
write_codemeta()
}
Run the code above in your browser using DataLab