rename: Change the NEWS.md file headings

View source: R/rename.R

renameR Documentation

Change the NEWS.md file headings

Description

Some 'NEWS.md' files have the package name in the heading. This is not yet supported in the 'collect' code. This convenience function will help the user modify those headings to exclude the package name and include the keywords 'Changes in version' for aggregating news files across packages. Version control of the NEWS files is highly recommended. By default, the function saves a '*.bak' backup NEWS file in the package directory.

Usage

rename(pkg, backup = ".bak", dry.run = TRUE)

Arguments

pkg

character(1) The directory location of the package usually the current directory (default: ".")

backup

character(1) The file extension to add for backing up the original news file (default: '.bak')

Value

Saves a "NEWS.md" file with substituted headers

Examples


# create phony DESC for usethis
# otherwise temp 'package' is not recognized
desc <- usethis:::build_description(
    basename(tempdir()), roxygen = TRUE, fields = list()
)
lines <- desc$str(by_field = TRUE, normalize = FALSE, mode = "file")
usethis:::write_over(
    file.path(tempdir(), "DESCRIPTION"), lines, quiet = TRUE
)

tempNews <- file.path(tempdir(), "NEWS.md")
writeLines("# TempPackage 0.99.0", con = file(tempNews))
rename(pkg = tempdir())
readLines(tempNews)


waldronlab/newsfeed documentation built on July 30, 2023, 1:22 a.m.