Skip to content

Commit e2ce434

Browse files
committed
chore: regen files
1 parent 81e7adf commit e2ce434

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+3121
-312
lines changed

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
export(create_pkg)
44
export(default_exclusions)
55
export(default_linters)
6-
export(funky_config)
76
export(gen_pkgdown_ref)
87
export(lint_rmd)
98
export(load_pkg)

R/pkgpurl.gen.R

Lines changed: 20 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,8 @@ assemble_license_notice <- function(path) {
108108
if (desc::desc_has_fields(keys = "License",
109109
file = path)) {
110110

111-
license <- pal::desc_get_field_safe(key = "License",
112-
file = path)
113-
114-
if (grepl(x = license,
111+
if (grepl(x = pal::desc_get_field_safe(key = "License",
112+
file = path),
115113
pattern = "^\\s*(AGPL ?\\(>= ?3\\)|AGPL-3\\.0-or-later)\\s*$")) {
116114

117115
notice <- c(paste0("This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as ",
@@ -468,7 +466,7 @@ create_pkg <- function(name,
468466

469467
usethis::use_description(fields = list(Package = name,
470468
URL = paste0("https://gitlab.com/rpkg.dev/", name),
471-
BugReports = paste0("https://gitlab.com/rpkg.dev/", name, "/-/issues")))
469+
BugReports = paste0("https://gitlab.com/rpkg.dev/", name, "/-/issues"))) # nolint: absolute_path_linter
472470
invisible(path)
473471
}
474472

@@ -597,7 +595,6 @@ load_pkg <- function(path = ".",
597595
add_copyright_notice = FALSE,
598596
add_license_notice = FALSE,
599597
gen_pkgdown_ref = FALSE,
600-
reset = TRUE,
601598
recompile = FALSE,
602599
export_all = TRUE,
603600
helpers = TRUE,
@@ -615,7 +612,6 @@ load_pkg <- function(path = ".",
615612

616613
# load pkg
617614
devtools::load_all(path = path,
618-
reset = reset,
619615
recompile = recompile,
620616
export_all = export_all,
621617
helpers = helpers,
@@ -735,11 +731,11 @@ purl_rmd <- function(path = ".",
735731
gen_pkgdown_ref <- FALSE
736732
}
737733

738-
rmd_files %>% purrr::walk(process_rmd,
739-
path_pkg = path,
740-
copyright_notice = copyright_notice,
741-
license_notice = license_notice)
742-
734+
purrr::walk(rmd_files,
735+
\(x) process_rmd(path_file = x,
736+
path_pkg = path,
737+
copyright_notice = copyright_notice,
738+
license_notice = license_notice))
743739
if (gen_pkgdown_ref) {
744740

745741
ref <-
@@ -1219,40 +1215,35 @@ gen_pkgdown_ref <- function(rmd,
12191215

12201216
#' pkgpurl's default lintr exclusions
12211217
#'
1222-
#' Opinionated set of files and folders to be excluded from linting, relative to the package path. To be used with [lint_rmd()], [lintr::lint_dir()] or
1223-
#' [lintr::lint_package()].
1218+
#' Returns an opinionated set of files and folders to be excluded from linting, relative to the root of the package directory. To be used with [lint_rmd()],
1219+
#' [lintr::lint_dir()] or [lintr::lint_package()].
12241220
#'
1225-
#' @param excl_vignettes Whether or not to exclude all `.Rmd` files under `vignettes/`. A logical scalar.
1221+
#' @param excl_inst Whether or not to exclude all files under `inst/`. A logical scalar.
1222+
#' @param excl_vignettes Whether or not to exclude all files under `vignettes/`. A logical scalar.
12261223
#'
12271224
#' @return A named list of [lintr::linters].
12281225
#' @seealso [`default_linters`][default_linters] and [lint_rmd()]
12291226
#' @export
12301227
#'
12311228
#' @examples
12321229
#' pkgpurl::default_exclusions()
1233-
default_exclusions <- function(excl_vignettes = TRUE) {
1230+
default_exclusions <- function(excl_inst = TRUE,
1231+
excl_vignettes = TRUE) {
12341232

1233+
checkmate::assert_flag(excl_inst)
12351234
checkmate::assert_flag(excl_vignettes)
12361235

12371236
c("docs",
12381237
"input",
1238+
"inst"[excl_inst],
12391239
"output",
1240+
"packrat",
12401241
"pkgdown",
12411242
"renv",
1242-
"packrat",
12431243
"tests",
1244-
list.files(path = "R",
1245-
recursive = TRUE,
1246-
full.names = TRUE,
1247-
pattern = "\\.gen\\.R$"),
1248-
list.files(path = "Rmd",
1249-
recursive = TRUE,
1250-
full.names = TRUE,
1251-
pattern = "\\.nopurl\\.Rmd$"),
1252-
if (excl_vignettes) list.files(path = "vignettes",
1253-
recursive = TRUE,
1254-
full.names = TRUE,
1255-
pattern = "\\.Rmd$"),
1244+
"vignettes"[excl_vignettes],
1245+
"R/*.gen.R",
1246+
"Rmd/*.nopurl.Rmd",
12561247
"README.Rmd")
12571248
}
12581249

@@ -1268,14 +1259,3 @@ default_exclusions <- function(excl_vignettes = TRUE) {
12681259
#' @examples
12691260
#' names(pkgpurl::default_linters)
12701261
"default_linters"
1271-
1272-
#' `r pkgsnip::title_lbl("funky_config", pkg = "pkgpurl")`
1273-
#'
1274-
#' `r pkgsnip::description_lbl("funky_config", pkg = "pkgpurl")`
1275-
#'
1276-
#' @format `r pkgsnip::return_lbl("tibble_cols", cols = colnames(funky_config))`
1277-
#' @export
1278-
#'
1279-
#' @examples
1280-
#' pkgpurl::funky_config
1281-
"funky_config"

R/sysdata.rda

5.18 KB
Binary file not shown.

README.md

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
<a href="https://cran.r-project.org/package=pkgpurl" class="pkgdown-release"><img src="https://r-pkg.org/badges/version/pkgpurl" alt="CRAN Status" /></a>
66

7-
pkgpurl facilitates R package authoring using a literate programming approach. The main idea behind this is to write all of the R source code in R Markdown files (`Rmd/*.Rmd`), which allows the actual code to be freely mixed with explanatory and supplementary information in expressive Markdown format. The main object of pkgpurl is to provide a standardized way to compile the bare `.R` files from the prose-enhanced and thus more human-oriented `.Rmd` files.
7+
pkgpurl facilitates R package authoring using a literate programming workflow. It enables you to write all R source code in R Markdown files, letting executable code coexist naturally with narrative explanations and supplementary context in expressive Markdown format. The primary purpose of pkgpurl is to provide a standardized way to compile the bare `.R` files from the richer, prose-enhanced `.Rmd` files.
88

9-
The basic idea behind the concept this package implements originates from Yihui Xie. See his blog post [*Write An R Package Using Literate Programming Techniques*](https://yihui.org/rlp/) for more details, it’s definitively worth reading. This package’s function [`pkgpurl::purl_rmd()`](https://pkgpurl.rpkg.dev/dev/reference/purl_rmd.html) is just a less cumbersome alternative to the Makefile approach outlined by him.
9+
The basic idea behind the concept this package implements originates from Yihui Xie. See his blog post [*Write An R Package Using Literate Programming Techniques*](https://yihui.org/rlp/) for more details, it’s definitively worth reading. This package’s function [`pkgpurl::purl_rmd()`](https://pkgpurl.rpkg.dev/reference/purl_rmd.html) is just a less cumbersome alternative to the Makefile approach outlined by him that offers additional convenience features like [auto-generating the pkgdown `Reference:` index](https://pkgpurl.rpkg.dev/reference/) or adding [copyright](https://pkgpurl.rpkg.dev/reference/purl_rmd.html#arg-add-copyright-notice) or [license](https://pkgpurl.rpkg.dev/reference/purl_rmd.html#arg-add-license-notice) notices.
10+
11+
Setting up a new project to write an R package in the R Markdown format differs slightly from the classic approach. [`pkgpurl::create_pkg()`](https://pkgpurl.rpkg.dev/reference/create_pkg.html) is offered as a convenience function similar to [`usethis::create_package()`](https://usethis.r-lib.org/reference/create_package.html) to populate a directory with all the files necessary for a new package in the R Markdown format.
1012

1113
## Pros and cons
1214

@@ -50,7 +52,7 @@ The relevant editor options which adjust the canonical Markdown generation can e
5052
</details>
5153
<details>
5254
<summary>
53-
👍 <strong>All your code in a single, well-structured file</strong>
55+
👍 <strong>All your main R code in a single, well-structured file</strong>
5456
</summary>
5557

5658
The [traditional recommendation](https://style.tidyverse.org/package-files.html) to not lose overview of your package’s R source code is to split it over multiple files. The popular (and very useful) book *R Packages* [gives the following advice](https://r-pkgs.org/code.html#sec-code-organising):
@@ -59,9 +61,9 @@ The [traditional recommendation](https://style.tidyverse.org/package-files.html)
5961
6062
I think this is just ridiculous.
6163

62-
Instead, I encourage you to keep all your code (as far as possible) in a single file `Rmd/PACKAGE_NAME.Rmd` and structure it according to the [rules described here](https://pkgpurl.rpkg.dev/dev/reference/gen_pkgdown_ref.html#details), which even allows the [pkgdown `Reference:` index](https://pkgdown.r-lib.org/reference/build_reference.html#reference-index) to be automatically in sync with the source code structure. As a result, you re-organize (and thus most likely improve) your package’s code structure whenever you intend to improve the pkgdown reference – and vice versa. For a basic example, see [this very package’s main source file](https://gitlab.com/rpkg.dev/pkgpurl/-/blob/master/Rmd/pkgpurl.Rmd?plain=0).
64+
Instead, I encourage you to keep all your code (as far as possible) in a single file `Rmd/PACKAGE_NAME.Rmd` and structure it according to the [rules described here](https://pkgpurl.rpkg.dev/reference/gen_pkgdown_ref.html#details), which even allows the [pkgdown `Reference:` index](https://pkgdown.r-lib.org/reference/build_reference.html#reference-index) to be automatically in sync with the source code structure. As a result, you re-organize (and thus most likely improve) your package’s code structure whenever you intend to improve the pkgdown reference – and vice versa. For a basic example, see [this very package’s main source file](https://gitlab.com/rpkg.dev/pkgpurl/-/blob/master/Rmd/pkgpurl.Rmd?plain=0).
6365

64-
Keeping all code in a single file frees you from the traditional hassle of finding a viable (but in the end still unsatisfactory) way to organize your R source code across multiple files. Of course, there are still good reasons to outsource code into separate files *in certain situations*, which nothing is stopping you from doing. You can also [exclude whole `.Rmd` files from purling using the `.nopurl.Rmd` filename suffix](https://pkgpurl.rpkg.dev/dev/reference/purl_rmd.html#-rmd-files-excluded-from-purling).
66+
Keeping all code in a single file frees you from the traditional hassle of finding a viable (but in the end still unsatisfactory) way to organize your R source code across multiple files. Of course, there are still good reasons to outsource code into separate files *in certain situations*, which nothing is stopping you from doing. You can also [exclude whole `.Rmd` files from purling using the `.nopurl.Rmd` filename suffix](https://pkgpurl.rpkg.dev/reference/purl_rmd.html#-rmd-files-excluded-from-purling).
6567

6668
</details>
6769
<details>
@@ -108,19 +110,9 @@ Unfortunately, there are also a few notable **drawbacks** of the R Markdown form
108110
👎 <strong>Additional workflow step</strong>
109111
</summary>
110112

111-
The pkgpurl approach on writing R packages in the R Markdown format introduces *one* additional step at the very beginning of typical package development workflows: Running [`pkgpurl::purl_rmd()`](https://pkgpurl.rpkg.dev/dev/reference/purl_rmd.html) to generate the `R/*.gen.R` files from the original `Rmd/*.Rmd` sources before documenting/checking/testing/building the package. Given sufficient user demand, this could probably be integrated into [devtools](https://devtools.r-lib.org/)’ functions in the future, so that no additional action has to be taken by the user when relying on RStudio’s built-in package building infrastructure.
112-
113-
For the time being, it’s recommended to set up a custom shortcut[^3] for one or both of [`pkgpurl::purl_rmd()`](https://pkgpurl.rpkg.dev/dev/reference/purl_rmd.html) and [`pkgpurl::process_pkg()`](https://pkgpurl.rpkg.dev/dev/reference/process_pkg.html) which are registered as [RStudio add-ins](https://rstudio.github.io/rstudioaddins/).
114-
115-
</details>
116-
<details>
117-
<summary>
118-
👎 <strong>Differing setup</strong>
119-
</summary>
120-
121-
Setting up a new project to write an R package in the R Markdown differs slightly from the classic approach. A suitable convenience function like `create_rmd_package()` to set up all the necessary parts could probably be added to [usethis](https://usethis.r-lib.org/) in the future.
113+
The pkgpurl approach on writing R packages in the R Markdown format introduces *one* additional step at the very beginning of typical package development workflows: Running [`pkgpurl::purl_rmd()`](https://pkgpurl.rpkg.dev/reference/purl_rmd.html) to generate the `R/*.gen.R` files from the original `Rmd/*.Rmd` sources before documenting/checking/testing/building the package. Given sufficient user demand, this could probably be integrated into [devtools](https://devtools.r-lib.org/)’ functions in the future, so that no additional action has to be taken by the user when relying on RStudio’s built-in package building infrastructure.
122114

123-
For the time being, you can use my ready-to-go [R Markdown Package Development Template](https://gitlab.com/salim_b/r/pkg-dev-tpl) as a starting point for creating new R packages in the R Markdown format.
115+
For the time being, it’s recommended to set up a custom shortcut[^3] for one or both of [`pkgpurl::purl_rmd()`](https://pkgpurl.rpkg.dev/reference/purl_rmd.html) and [`pkgpurl::process_pkg()`](https://pkgpurl.rpkg.dev/reference/process_pkg.html) which are registered as [RStudio add-ins](https://rstudio.github.io/rstudioaddins/).
124116

125117
</details>
126118
<details>
@@ -173,7 +165,7 @@ Some of pkgpurl’s functionality is controlled via package-specific global conf
173165

174166
## Development
175167

176-
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/rpkg-dev/pkgpurl)
168+
[![Ask DeepWiki](https://rpkg.dev/badge_deepwiki.svg)](https://deepwiki.com/rpkg-dev/pkgpurl)
177169

178170
### R Markdown format
179171

docs/dev/LICENSE.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)