rstudio / blogdown

Create Blogs and Websites with R Markdown
https://pkgs.rstudio.com/blogdown/
1.74k stars 330 forks source link

install_hugo does not check the version when checking for already installed version #515

Closed cderv closed 4 years ago

cderv commented 4 years ago

When you try to run a blogdown site with the wrong hugo version, you now get an error message

<error/rlang_error>
Erreur : Found 'hugo' at 'C:\Users\chris\scoop\shims\hugo.exe' but its version is 0.78.2 instead of the requested version 0.76.5. You may try blogdown::install_hugo("0.76.5").
Backtrace:
Run `rlang::last_trace()` to see the full context.

The advice is to run blogdown::install_hugo() with correct version, but without force = TRUE it won't install the asked version.

168 MiB [<no git>] > blogdown::install_hugo("0.76.5")
It seems Hugo has been installed. Use force = TRUE to reinstall or upgrade.*

So it is one more step to run

blogdown::install_hugo("0.76.5", force = TRUE)

before being able to preview the website which had a pinned hugo version.

I think we should either:

What do you think ?

yihui commented 4 years ago

The argument force = TRUE is no longer useful, so I just deprecated it. It was there originally only because install_hugo() may install Hugo to a place in PATH, and I wanted to avoid the unnecessary install when it could be detected in PATH. Thanks!