document_NVIpkg: Update styling and documentation of a package

View source: R/document_NVIpkg.R

document_NVIpkgR Documentation

Update styling and documentation of a package

Description

A wrapper around functions for styling, write the help files and update README and CONTRIBUTING.md.

Usage

document_NVIpkg(
  pkg = stringi::stri_extract_last_words(usethis::proj_path()),
  pkg_path = usethis::proj_path(),
  style = FALSE,
  manual = "update",
  contributing = FALSE,
  readme = FALSE,
  ...
)

Arguments

pkg

[character(1)]
The package name. Defaults to stringi::stri_extract_last_words(usethis::proj_path()).

pkg_path

[character(1)]
The path to the package directory. Defaults to usethis::proj_path().

style

[logica(1)l]
Should the package be styled, defaults to FALSE.

manual

[character(1)]
Should a reference manual be included, updated or removed. Defaults to manual = "update" that will update the manual if exists and do nothing if it doesn't exist.

contributing

[logical(1)]
Should CONTRIBUTING.md and the vignette "Contribute to NVIpkg" be updated, defaults to FALSE.

readme

[logical(1)]
Should README be updated, defaults to FALSE.

...

Other arguments to be passed to styler::style_pkg.

Details

The help files for R-functions will always be generated. Whether styling should be performed and README and CONTRIBUTING.md should be updated are controlled by input arguments.

Default value for styling is scope = "spaces". Input to scope can be any subset of c("spaces", "indention", "line_breaks", "tokens"). For indention, rather use Ctrl+I than scope = "indention". Be careful if using scope = "tokens" as code may be broken.

Value

none. Updated help files for all functions and, depending on argument input, can updated style, CONTRIBUTING.md, and README

Author(s)

Petter Hopp Petter.Hopp@vetinst.no

Examples

## Not run: 

# Attach packages and set up with temporary directory
library(NVIpackager)
td <- tempdir()
if (!dir.exists(file.path(td, "NVItest"))) {
  dir.create(file.path(td, "NVItest"))
}
if (!dir.exists(file.path(td, "NVItest", "vignettes"))) {
  dir.create(file.path(td, "NVItest", "vignettes"))
}

document_NVIpkg(pkg = "NVItest",
                pkg_path = file.path(td, "NVItest"),
                style = FALSE,
                contributing = TRUE,
                readme = TRUE)

## End(Not run)


PetterHopp/NVIpackager documentation built on Sept. 14, 2024, 1:24 a.m.