Skip to content

Commit

Permalink
scan_deps(): bookdown, pkgdown, quarto (#410)
Browse files Browse the repository at this point in the history
* scan_deps(): bookdown, pkgdown, quarto

* scan_deps(): .rmarkdown support
  • Loading branch information
gaborcsardi authored Dec 15, 2024
1 parent 1e95579 commit 040acf5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
3 changes: 3 additions & 0 deletions R/scan-deps.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ scan_deps_pattern <- function() {
"[.]r$",
"[.]Rmd$",
"[.]rmd$",
"[.]rmarkdown",
"[.]Rmarkdown",
"[.]qmd$",
"^_bookdown[.]yml$",
"^_quarto[.]yml$",
Expand Down Expand Up @@ -261,6 +263,7 @@ scan_path_deps_do <- function(code, path) {
ext,
".r" = scan_path_deps_do_r(code, path),
".qmd" = ,
".rmarkdown" = ,
".rmd" = scan_path_deps_do_rmd(code, path),
"DESCRIPTION" = scan_path_deps_do_dsc(code, path),
"NAMESPACE" = scan_path_deps_do_namespace(code, path),
Expand Down
24 changes: 13 additions & 11 deletions tests/testthat/_snaps/unix/scan-deps.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
Code
scan_deps(project)[]
Output
# A data frame: 6 x 9
path ref package version type code start_row start_column start_byte
<chr> <chr> <chr> <chr> <chr> <chr> <int> <int> <int>
1 R/code.R CD CD * prod CD::pkg 4 1 26
2 R/code.R AB AB * prod library(AB) 1 1 1
3 R/code.R BC BC * prod require(BC) 2 1 13
4 doc.qmd pkgload pkgload * prod pkgload::load_all 12 1 174
5 index.Rmd ST ST * prod ST::fun 10 1 97
6 index.Rmd RS RS * prod library(RS) 9 1 85
# A data frame: 8 x 9
path ref package version type code start_row start_column start_byte
<chr> <chr> <chr> <chr> <chr> <chr> <int> <int> <int>
1 R/code.R CD CD * prod CD::pkg 4 1 26
2 R/code.R AB AB * prod library(AB) 1 1 1
3 R/code.R BC BC * prod require(BC) 2 1 13
4 doc.qmd pkgload pkgload * prod pkgload::load_all 12 1 174
5 index.Rmarkdown ST ST * prod ST::fun 10 1 97
6 index.Rmarkdown RS RS * prod library(RS) 9 1 85
7 index.Rmd ST ST * prod ST::fun 10 1 97
8 index.Rmd RS RS * prod library(RS) 9 1 85

---

Expand All @@ -23,8 +25,8 @@
+ AB @ R/code.R
+ BC @ R/code.R
+ CD @ R/code.R
+ RS @ index.Rmd
+ ST @ index.Rmd
+ RS @ index.Rmarkdown, index.Rmd
+ ST @ index.Rmarkdown, index.Rmd
+ pkgload @ doc.qmd

# scan_path_deps
Expand Down
11 changes: 11 additions & 0 deletions tests/testthat/fixtures/scan/project-1/index.Rmarkdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: pkgdepends
output:
github_document:
always_allow_html: yes
---

```{r}
library(RS)
ST::fun()
```

0 comments on commit 040acf5

Please sign in to comment.