updateDependencies: Update the dependencies

Description Usage Arguments Details Value Author(s) Examples

View source: R/updateDependencies.R

Description

Update the book's DESCRIPTION file with the latest dependencies.

Usage

1
2
3
4
5
6
7
updateDependencies(
  dir = ".",
  extra = NULL,
  indent = 4,
  field = "Suggests",
  ...
)

Arguments

dir

String containing the path to the directory containing the book DESCRIPTION file.

extra

Character vector of extra packages to be added to imports, usually from packages that are in Suggests and thus not caught directly by scrapeDependencies.

indent

Integer scalar specifying the size of the indent to use when listing packages.

field

String specifying the dependency field to store the packages in. Defaults to "Suggests" by convention.

...

Further arguments to pass to scrapeDependencies.

Details

The book DESCRIPTION is useful for quick installation of all packages required across all chapters. For example, it is used by https://github.com/LTLA/TrojanBookBuilder to populate a trojan package's dependencies, ensuring that all packages are available when the book itself is compiled.

Value

The specified field in the DESCRIPTION file in dir is updated. NULL is invisibly returned.

Author(s)

Aaron Lun

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
dir <- tempfile()
dir.create(dir)

write(file=file.path(dir, "DESCRIPTION"), 
"Package: son.of.godzilla 
Version: 0.0.1
Description: Like godzilla, but smaller.")

tmp <- file.path(dir, "alpha.Rmd")
write(file=tmp, "```{r, echo=FALSE, results='asis'}
rebook::chapterPreamble()
```

```{r}
A::func
library(C)
```")

tmp <- file.path(dir, "bravo.Rmd")
write(file=tmp, "```{r, echo=FALSE, results='asis'}
rebook::chapterPreamble()
```

```{r}
require(D)
B::more
```")

updateDependencies(dir)
cat(readLines(file.path(dir, "DESCRIPTION")), sep="\n")

rebook documentation built on Nov. 8, 2020, 4:56 p.m.