Skip to content

Commit

Permalink
Add note about soft pandoc dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
owenjonesuob committed Dec 27, 2020
1 parent ea3e520 commit 8feaa26
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
9 changes: 8 additions & 1 deletion R/news.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ news <- function(package, installed_only = FALSE, allow_changelog = TRUE, width
)

# If none of those worked, then we didn't manage to find a news file :(
stop(sprintf("No news found for package '%s'", package))
stop(
sprintf("No news found for package '%s'", package),
if (!nzchar(Sys.which("pandoc"))) paste0(
"... although, it looks like `pandoc` isn't on your PATH, ",
"and we need it to convert HTML news files to markdown. ",
"So it might be worth making sure `pandoc` is available, and trying again!"
)
)
}


Expand Down
38 changes: 21 additions & 17 deletions tests/testthat/test-news.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,6 @@ test_that("web", {

skip_if_offline()

# Try a few CRAN packages
expect_equal(
tail(news("dplyr"), 1),
"download size from 2.8 MB to 0.5 MB."
)

expect_equal(
tail(news("checkLuhn"), 1),
"- First release"
)

expect_equal(
tail(news("goodpractice"), 1),
"First public release."
)



# This one doesn't have a NEWS file or changelog
expect_error(
Expand Down Expand Up @@ -68,4 +51,25 @@ test_that("web", {
"o Package introduced."
)



# Try a few CRAN packages
skip_if(!nzchar(Sys.which("pandoc")))

expect_equal(
tail(news("dplyr"), 1),
"download size from 2.8 MB to 0.5 MB."
)

expect_equal(
tail(news("checkLuhn"), 1),
"- First release"
)

expect_equal(
tail(news("goodpractice"), 1),
"First public release."
)


})

0 comments on commit 8feaa26

Please sign in to comment.