/usr/lib/R/site-library/desc/README.md is in r-cran-desc 1.1.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | # desc
> Parse DESCRIPTION files
[![Linux Build Status](https://travis-ci.org/r-lib/desc.svg?branch=master)](https://travis-ci.org/r-lib/desc)
[![Windows Build status](https://ci.appveyor.com/api/projects/status/github/r-lib/desc?svg=true)](https://ci.appveyor.com/project/gaborcsardi/desc)
[![](http://www.r-pkg.org/badges/version/desc)](http://www.r-pkg.org/pkg/desc)
[![CRAN RStudio mirror downloads](http://cranlogs.r-pkg.org/badges/desc)](http://www.r-pkg.org/pkg/desc)
[![Coverage Status](https://img.shields.io/codecov/c/github/r-lib/desc/master.svg)](https://codecov.io/github/r-lib/desc?branch=master)
Parse, manipulate and reformat DESCRIPTION files. The package
provides two APIs, one is object oriented, the other one is
procedural and manipulates the files *in place*.
---
- [Installation](#installation)
- [The object oriented API](#the-oo-api)
- [Introduction](#introduction)
- [Loading or creating new `DESCRIPTION` files](#loading-or-creating-new-description-files)
- [Normalizing `DESCRIPTION` files](#normalizing-description-files)
- [Querying, changing and removing fields](#querying-changing-and-removing-fields)
- [Dependencies](#dependencies)
- [Collate fields](#collate-fields)
- [Authors](#authors)
- [The procedural API](#the-procedural-api)
- [License](#license)
## Installation
```r
source("https://install-github.me/r-lib/desc")
```
## The object oriented API
```r
library(desc)
```
### Introduction
The object oriented API uses [R6](https://github.com/wch/R6) classes.
### Loading or creating new `DESCRIPTION` files
A new `description` object can be created by reading a `DESCRPTION`
file form the disk. By default the `DESCRIPTION` file in the current
directory is read:
```r
desc <- description$new()
desc
```
```
#> Package: desc
#> Title: Manipulate DESCRIPTION Files
#> Version: 1.0.0
#> Author: Gábor Csárdi
#> Maintainer: Gábor Csárdi <csardi.gabor@gmail.com>
#> Description: Tools to read, write, create, and manipulate DESCRIPTION
#> files. It is intented for packages that create or manipulate other
#> packages.
#> License: MIT + file LICENSE
#> URL: https://github.com/r-lib/desc
#> BugReports: https://github.com/r-lib/desc/issues
#> Imports:
#> R6
#> Suggests:
#> testthat,
#> whoami,
#> newpackage
#> Encoding: UTF-8
#> LazyData: true
#> RoxygenNote: 5.0.0
```
A new object can also be created from scratch:
```r
desc2 <- description$new("!new")
desc2
```
```
#> Package: {{ Package }}
#> Title: {{ Title }}
#> Version: 1.0.0
#> Authors@R (parsed):
#> * Jo Doe <jodoe@dom.ain> [aut, cre]
#> Maintainer: {{ Maintainer }}
#> Description: {{ Description }}
#> License: {{ License }}
#> URL: {{ URL }}
#> BugReports: {{ BugReports }}
#> Encoding: UTF-8
#> LazyData: true
```
### Normalizing `DESCRIPTION` files
Most `DESCRIPTION` fields may be formatted in multiple equivalent
ways. `desc` does not reformat fields, unless they are
updated or reformatting is explicitly requested via a call to
the `normalize()` method or using the `normalize` argument of the
`write()` method.
### Querying, changing and removing fields
`get()` and `set()` queries or updates a field:
```r
desc$set("Package", "foo")
desc$get("Package")
```
```
#> Package
#> "foo"
```
They work with multiple fields as well:
```r
desc$set(Package = "bar", Title = "Bar Package")
desc$get(c("Package", "Title"))
```
```
#> Package Title
#> "bar" "Bar Package"
```
### Dependencies
Package dependencies can be set and updated via an easier API:
```r
desc$get_deps()
```
```
#> type package version
#> 1 Suggests testthat *
#> 2 Suggests whoami *
#> 3 Suggests newpackage *
#> 4 Imports R6 *
```
```r
desc$set_dep("mvtnorm")
desc$set_dep("Rcpp", "LinkingTo")
desc$get_deps()
```
```
#> type package version
#> 1 Suggests testthat *
#> 2 Suggests whoami *
#> 3 Suggests newpackage *
#> 4 Imports R6 *
#> 5 Imports mvtnorm *
#> 6 LinkingTo Rcpp *
```
```r
desc
```
```
#> Package: bar
#> Title: Bar Package
#> Version: 1.0.0
#> Author: Gábor Csárdi
#> Maintainer: Gábor Csárdi <csardi.gabor@gmail.com>
#> Description: Tools to read, write, create, and manipulate DESCRIPTION
#> files. It is intented for packages that create or manipulate other
#> packages.
#> License: MIT + file LICENSE
#> URL: https://github.com/r-lib/desc
#> BugReports: https://github.com/r-lib/desc/issues
#> Imports:
#> R6,
#> mvtnorm
#> Suggests:
#> testthat,
#> whoami,
#> newpackage
#> LinkingTo:
#> Rcpp
#> Encoding: UTF-8
#> LazyData: true
#> RoxygenNote: 5.0.0
```
### Collate fields
Collate fields can be queried and set using simple character
vectors of file names:
```r
desc$set_collate(list.files("../R"))
desc$get_collate()
```
```
#> [1] "assertions.R" "authors-at-r.R" "classes.R"
#> [4] "collate.R" "constants.R" "deps.R"
#> [7] "description.R" "encoding.R" "latex.R"
#> [10] "non-oo-api.R" "package-archives.R" "read.R"
#> [13] "remotes.R" "str.R" "syntax_checks.R"
#> [16] "urls.R" "utils.R" "validate.R"
#> [19] "version.R"
```
### Authors
Authors information, when specified via the `Authors@R` field,
also has a simplified API:
```r
desc <- description$new("DESCRIPTION2")
desc$get_authors()
```
```
#> [1] "Hadley Wickham <h.wickham@gmail.com> [aut, cre, cph]"
#> [2] "Peter Danenberg <pcd@roxygen.org> [aut, cph]"
#> [3] "Manuel Eugster [aut, cph]"
#> [4] "RStudio [cph]"
```
```r
desc$add_author("Bugs", "Bunny", email = "bb@acme.com")
desc$add_me()
desc$get_authors()
```
```
#> [1] "Hadley Wickham <h.wickham@gmail.com> [aut, cre, cph]"
#> [2] "Peter Danenberg <pcd@roxygen.org> [aut, cph]"
#> [3] "Manuel Eugster [aut, cph]"
#> [4] "RStudio [cph]"
#> [5] "Bugs Bunny <bb@acme.com>"
#> [6] "Gabor Csardi <csardi.gabor@gmail.com> [ctb]"
```
## The procedural API
The procedural API is simpler to use for one-off `DESCRIPTION`
manipulation, since it does not require dealing with
`description` objects. Each object oriented method has a
procedural counterpart that works on a file, and potentially
writes its result back to the same file.
For example, adding a new dependency to `DESCRIPTION` in the
current working directory can be done with
```r
desc_set_dep("newpackage", "Suggests")
```
```
#> Package: desc
#> Title: Manipulate DESCRIPTION Files
#> Version: 1.0.0
#> Author: Gábor Csárdi
#> Maintainer: Gábor Csárdi <csardi.gabor@gmail.com>
#> Description: Tools to read, write, create, and manipulate DESCRIPTION
#> files. It is intented for packages that create or manipulate other
#> packages.
#> License: MIT + file LICENSE
#> URL: https://github.com/r-lib/desc
#> BugReports: https://github.com/r-lib/desc/issues
#> Imports:
#> R6
#> Suggests:
#> testthat,
#> whoami,
#> newpackage
#> Encoding: UTF-8
#> LazyData: true
#> RoxygenNote: 5.0.0
```
This added `newpackage` to the `Suggests` field:
```r
desc_get("Suggests")
```
```
#> Suggests
#> "\n testthat,\n whoami,\n newpackage"
```
So the full list of dependencies are now
```r
desc_get_deps()
```
```
#> type package version
#> 1 Suggests testthat *
#> 2 Suggests whoami *
#> 3 Suggests newpackage *
#> 4 Imports R6 *
```
## License
MIT © [Gábor Csárdi](https://github.com/gaborcsardi).
|