Skip to content

Commit bbbfe9b

Browse files
committed
Fix #208
1 parent 083ca89 commit bbbfe9b

File tree

5 files changed

+24
-22
lines changed

5 files changed

+24
-22
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Description: Function-oriented Make-like declarative pipelines for
99
reproducible pipelines concisely and compactly.
1010
The methods in this package were influenced by the 'targets' R package.
1111
by Will Landau (2018) <doi:10.21105/joss.00550>.
12-
Version: 0.11.0.9002
12+
Version: 0.11.0.9003
1313
License: MIT + file LICENSE
1414
URL: https://docs.ropensci.org/tarchetypes/, https://github.com/ropensci/tarchetypes
1515
BugReports: https://github.com/ropensci/tarchetypes/issues

NEWS.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
# tarchetypes 0.11.0.9002
1+
# tarchetypes 0.11.0.9003
22

33
* Fix `tar_combine()` help file examples (#206, @weberse2).
44
* Account for project-level `output_dir` in non-project `tar_quarto()` calls (#207, @brndngrhm).
5+
* Use name when passing the `quiet` argument to `quarto_inspect()` (#208, @yusuke-sasaki-jprep).
6+
* Explicitly pass the `profile` argument to `quarto_inspect()` and `quarto_render()`. Requires R package `quarto >= 1.4`, which is already in the `DESCIRPTION`.
57

68
# tarchetypes 0.11.0
79

R/tar_quarto_files.R

+14-9
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,10 @@ tar_quarto_files <- function(path = ".", profile = NULL, quiet = TRUE) {
4343
targets::tar_assert_scalar(profile %|||% ".")
4444
targets::tar_assert_chr(profile %|||% ".")
4545
targets::tar_assert_nzchar(profile %|||% ".")
46-
if (!is.null(profile)) {
47-
withr::local_envvar(.new = c(QUARTO_PROFILE = profile))
48-
}
4946
out <- if_any(
5047
fs::is_dir(path),
51-
tar_quarto_files_project(path, quiet),
52-
tar_quarto_files_document(path, quiet)
48+
tar_quarto_files_project(path, profile, quiet),
49+
tar_quarto_files_document(path, profile, quiet)
5350
)
5451
for (field in c("sources", "output", "input")) {
5552
out[[field]] <- as.character(fs::path_rel(out[[field]]))
@@ -58,8 +55,12 @@ tar_quarto_files <- function(path = ".", profile = NULL, quiet = TRUE) {
5855
out
5956
}
6057

61-
tar_quarto_files_document <- function(path, quiet) {
62-
info <- quarto::quarto_inspect(input = path, quiet = quiet)
58+
tar_quarto_files_document <- function(path, profile, quiet) {
59+
info <- quarto::quarto_inspect(
60+
input = path,
61+
profile = profile,
62+
quiet = quiet
63+
)
6364
out <- list()
6465
# Collect data about source files.
6566
out$sources <- tar_quarto_files_get_source_files(info$fileInformation)
@@ -82,8 +83,12 @@ tar_quarto_files_document <- function(path, quiet) {
8283
out
8384
}
8485

85-
tar_quarto_files_project <- function(path, quiet) {
86-
info <- quarto::quarto_inspect(input = path, quiet)
86+
tar_quarto_files_project <- function(path, profile, quiet) {
87+
info <- quarto::quarto_inspect(
88+
input = path,
89+
profile = profile,
90+
quiet = quiet
91+
)
8792
targets::tar_assert_nonempty(
8893
info$config$project$`output-dir`,
8994
paste(

R/tar_quarto_raw.R

+5-8
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ tar_quarto_command <- function(
139139
quiet = quiet,
140140
quarto_args = quarto_args,
141141
pandoc_args = pandoc_args,
142+
profile = profile,
142143
as_job = FALSE
143144
),
144145
env = list(
@@ -152,7 +153,8 @@ tar_quarto_command <- function(
152153
debug = debug,
153154
quiet = quiet,
154155
quarto_args = quarto_args,
155-
pandoc_args = pandoc_args
156+
pandoc_args = pandoc_args,
157+
profile = profile
156158
)
157159
)
158160
deps <- sort(unique(unlist(map(sources, ~knitr_deps(.x)))))
@@ -164,8 +166,7 @@ tar_quarto_command <- function(
164166
deps = deps,
165167
sources = sources,
166168
output = output,
167-
input = input,
168-
profile = profile
169+
input = input
169170
)
170171
as.expression(as.call(expr))
171172
}
@@ -184,7 +185,6 @@ tar_quarto_command <- function(
184185
#' @param output Character vector of Quarto output files and directories.
185186
#' @param input Character vector of non-source Quarto input files
186187
#' and directories.
187-
#' @param profile Quarto profile.
188188
#' @examples
189189
#' if (identical(Sys.getenv("TAR_LONG_EXAMPLES"), "true")) {
190190
#' targets::tar_dir({ # tar_dir() runs code from a temporary directory.
@@ -207,13 +207,10 @@ tar_quarto_command <- function(
207207
#' file.exists(files)
208208
#' })
209209
#' }
210-
tar_quarto_run <- function(args, deps, sources, output, input, profile) {
210+
tar_quarto_run <- function(args, deps, sources, output, input) {
211211
rm(deps)
212212
gc()
213213
assert_quarto()
214-
if (!is.null(profile)) {
215-
withr::local_envvar(.new = c(QUARTO_PROFILE = profile))
216-
}
217214
args <- args[!map_lgl(args, is.null)]
218215
do.call(what = quarto::quarto_render, args = args)
219216
support <- sprintf("%s_files", fs::path_ext_remove(basename(args$input)))

man/tar_quarto_run.Rd

+1-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)