Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build_dir() renders Rmd although output is newer due to other file with the same basename #308

Closed
solarchemist opened this issue Jun 28, 2018 · 1 comment
Milestone

Comments

@solarchemist
Copy link

I think I might have stumbled over an unexpected quirk of the "Build Website" button in Rstudio server (actually, the build pipeline in general). I think I have nailed down the issue to these particular lines in build_dir():

bases = with_ext(files, '')
files = files[!i & bases == bases[i]]  # files with same basename as f (Rmd)
if (length(files) == 0 || any(older_than(files, f))) render_it()

It just so happens, in my case, that my blog post folders (coming from Jekyll) are named like 2018-06-28-cool-project, with both the Rmd and Rproj file always using the same basename (2018-06-28-cool-project.Rmd, 2018-06-28-cool-project.Rproj). I don't remember where I picked up this convention, but in any case, it succesfully manages to trick the older_than check to always detect an older "output" file, since (in this case) the Rproj file is indeed older and always shares the same basename with the Rmd file.

A simple demonstration:

> files
[1] "/hugo/content/post/2018-06-28-cool-project/2018-06-28-cool-project.html" 
[2] "/hugo/content/post/2018-06-28-cool-project/2018-06-28-cool-project.Rproj"
> f 
"/hugo/content/post/2018-06-28-cool-project/2018-06-28-cool-project.Rmd"
> blogdown:::older_than(files, f)
[1] FALSE  TRUE

Which naturally causes any(older_than(files, f)) to always return TRUE.

This causes much longer rebuilds than necessary (although I must say the Hugo step really is a bullet train compared to Jekyll's horsecart!).

A simple solution for me would be to just change the names of my Rproj files to something other than the basename of my Rmd files. But I thought perhaps this situation might affect others and warrant a different approach?

@yihui yihui closed this as completed in 837e41e Jun 29, 2018
@yihui yihui added this to the v0.7 milestone Jun 29, 2018
@yihui
Copy link
Member

yihui commented Jun 29, 2018

Should be fixed now. Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants