Closed shirdekel closed 3 years ago
Oh dear I really made a mess of this one somehow. I have no idea how the test I ran yesterday worked, probably some stale state I guess.
Thanks so much for the report, no PR necessary, I'll be using this one myself frequently.
I think I have fixed this now?
Thanks! It works when analysis.Rmd
doesn't exist, but my third point is still an issue. That is, when analysis.Rmd
exists, then I get the following:
doc/analysis.Rmd already exists and was not overwritten.
Add this target to your tar_plan():
tar_render(doc/analysis.Rmd, "doc/doc/analysis.Rmd.Rmd")
Perhaps just change file_path
here to target_name
?
Ohhh sorry my bad, I misunderstood the 3rd item!
That was the fix thanks. Feel free to add yourself as a ctb in the DESCRIPTION if you like 👍
Yep, works now! I'll send a pull request shortly, thank you 😄
Hey Miles, thanks for making this;
tflow
might be what finally gets me over the line to try outtargets
in an actual project. Just had some issues withuse_rmd
, which I'm some have easy fixes.use_rmd("analysis")
I get the following error:I'm not sure how to set up a reprex to make it work with all the
usethis
calls, but the error seems to come from thisglue
call inrmd_target
:Created on 2021-01-22 by the reprex package (v0.3.0)
Session info
devtools::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.0.2 (2020-06-22) #> os macOS Mojave 10.14.6 #> system x86_64, darwin17.0 #> ui X11 #> language (EN) #> collate en_AU.UTF-8 #> ctype en_AU.UTF-8 #> tz Australia/Sydney #> date 2021-01-22 #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date lib source #> assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.0) #> callr 3.5.1 2020-10-13 [1] CRAN (R 4.0.2) #> cli 2.2.0 2020-11-20 [1] CRAN (R 4.0.2) #> crayon 1.3.4 2017-09-16 [1] CRAN (R 4.0.0) #> desc 1.2.0 2018-05-01 [1] CRAN (R 4.0.0) #> devtools 2.3.0 2020-04-10 [1] CRAN (R 4.0.0) #> digest 0.6.27 2020-10-24 [1] CRAN (R 4.0.2) #> ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.0.0) #> evaluate 0.14 2019-05-28 [1] CRAN (R 4.0.0) #> fansi 0.4.2 2021-01-15 [1] CRAN (R 4.0.2) #> fs 1.5.0 2020-07-31 [1] CRAN (R 4.0.2) #> glue 1.4.2 2020-08-27 [1] CRAN (R 4.0.2) #> highr 0.8 2019-03-20 [1] CRAN (R 4.0.0) #> htmltools 0.5.0 2020-06-16 [1] CRAN (R 4.0.2) #> knitr 1.30 2020-09-22 [1] CRAN (R 4.0.2) #> lifecycle 0.2.0 2020-03-06 [1] CRAN (R 4.0.0) #> magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.0.2) #> memoise 1.1.0 2017-04-21 [1] CRAN (R 4.0.0) #> pkgbuild 1.2.0 2020-12-15 [1] CRAN (R 4.0.2) #> pkgload 1.1.0 2020-05-29 [1] CRAN (R 4.0.0) #> prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.0.0) #> processx 3.4.5 2020-11-30 [1] CRAN (R 4.0.2) #> ps 1.5.0 2020-12-05 [1] CRAN (R 4.0.2) #> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.0.0) #> R6 2.5.0 2020-10-28 [1] CRAN (R 4.0.2) #> remotes 2.2.0 2020-07-21 [1] CRAN (R 4.0.2) #> rlang 0.4.10 2020-12-30 [1] CRAN (R 4.0.2) #> rmarkdown 2.5 2020-10-21 [1] CRAN (R 4.0.2) #> rprojroot 2.0.2 2020-11-15 [1] CRAN (R 4.0.2) #> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.0) #> stringi 1.5.3 2020-09-09 [1] CRAN (R 4.0.2) #> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.0.0) #> testthat 3.0.1 2020-12-17 [1] CRAN (R 4.0.2) #> usethis 2.0.0 2020-12-10 [1] CRAN (R 4.0.2) #> withr 2.4.0 2021-01-16 [1] CRAN (R 4.0.2) #> xfun 0.19 2020-10-30 [1] CRAN (R 4.0.2) #> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.0.0) #> #> [1] /Library/Frameworks/R.framework/Versions/4.0/Resources/libraryI'd be happy to submit a pull request, but I'm unsure what
{target}
is meant to be. In your README it's simply "report" and indflow:::rmd_target
you made it "target_name". So maybe just remove the curly brackets?Separately, the
paste
call has both'.Rmd'
andsep = '.'
, which ends up like this for me:target_name <- "analysis" report_dir <- "doc" file.path(report_dir, paste(target_name, '.Rmd', sep = '.'))
> [1] "doc/analysis..Rmd"
Created on 2021-01-22 by the reprex package (v0.3.0)
Also,
rmd_target(file_path)
could just bermd_target(target_name)
ifrmd_target
already adds in the file path and extension, right? Otherwise it ends up like this:target_name <- "analysis" report_dir <- "doc" target_file <- paste0(target_name, ".Rmd") file_path <- file.path(report_dir, target_file) file.path(report_dir, paste(file_path, ".Rmd", sep = "."))
> [1] "doc/doc/analysis.Rmd..Rmd"
Created on 2021-01-22 by the reprex package (v0.3.0)
Let me know if you'd like a pull request and/or if my assumptions are off.