Learn R Programming

packager (version 1.9.0)

set_desc_url: Set a DESCRIPTION File's URL Field

Description

I frequently forget to add an URL to my packages' DESCRIPTION files, and when I do not, I often forget to check that the URL is valid, respectively the one I want. So this is a wrapper to functions from desc and gert and messaging and/or adding a reminder to file TODO.md.

Usage

set_desc_url(
  url,
  path = ".",
  normalize = TRUE,
  overwrite = FALSE,
  do_commit = is_force(),
  do_remind = !isTRUE(getOption("packager")[["force"]]),
  verbose = getOption("packager")[["verbose"]]
)

Arguments

url

A character string giving the URL to set or add in DESCRIPTION.

path

Path to the DESCRIPTION file, see desc::desc_get_urls.

normalize
overwrite

Set (overwrite) the URL field in DESCRIPTION instead adding the URL given to the URL field in DESCRIPTION?

do_commit

Commit the updated DESCRIPTION?

do_remind

Write a reminder into the package's TODO.md?

verbose

Be verbose?

Value

Invisibly TRUE

Examples

Run this code
# NOT RUN {
path <- file.path(tempdir(), "myPackage")
unlink(path, recursive = TRUE)
usethis::create_package(path, open = FALSE)
gert::git_init(path)
gert::git_add(repo = path, files = ".")
signature <- gert::git_signature(name = "Foobar", email = "no@where.com")
gert::git_commit(repo = path, message = "Initial commit",
                 author = signature, committer = signature)
url <- provide_gitlab_url(path = path)
set_desc_url(url, path = path)
grep("URL:", readLines(file.path(path, "DESCRIPTION")), value = TRUE)
readLines(file.path(path, "TODO.md"))
# }

Run the code above in your browser using DataLab