-
Notifications
You must be signed in to change notification settings - Fork 336
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
fix override when included in as_pkgdown
#2406
Conversation
R/package.R
Outdated
@@ -9,6 +9,11 @@ | |||
#' @export | |||
as_pkgdown <- function(pkg = ".", override = list()) { | |||
if (is_pkgdown(pkg)) { | |||
if (is.list(pkg$meta)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for digging this up! Can you please use modify_list()
instead since that already handles the NULL
case, which should simplify this code a bit 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just copying the version a couple of lines down; I just changed that one to modify_list
too for consistency sake
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, also, I was checking if x
rather than y
is null
; there are cases when pkg$meta
is NULL. I just included a change to modify_list
that checks both arguments so we can use that instead like you were suggesting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thanks!
tests/testthat/test-init.R
Outdated
@@ -46,3 +46,13 @@ test_that("site meta doesn't break unexpectedly", { | |||
|
|||
expect_snapshot(yaml) | |||
}) | |||
|
|||
test_that("override works correctly for as_pkgdown", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest putting this test in test-package.R
since that's corresponds to the file where you changed the code.
@@ -86,7 +86,7 @@ isFALSE <- function(x) { | |||
} | |||
|
|||
modify_list <- function(x, y) { | |||
if (is.null(y)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If x
is NULL
I think you should return y
?
David's fix was merged into pkgdown and it was released (thank you @hadley)! r-lib/pkgdown#2406 Remove CI workaround.
Fixes #2257. I wasn't exactly sure where to put the test, but figured it was better to include a brief test somewhere.
As with the other issue, I actually ran into this doing
build_site_github_pages()
, but figured it was better to fix at the root