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

Remove lazyeval dependency. #74

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Authors@R: c(
person("Jon", "Harmon", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-4781-4346")),
person("Myfanwy", "Johnston", , "[email protected]", role = "aut"),
person("Jordan", "Bradford", , "[email protected]", role = "aut"),
person("David", "Robinson", , "[email protected]", role = c("aut", "cph"))
)
Description: Download and process public domain works in the Project
Expand All @@ -21,7 +22,6 @@ Imports:
cli,
dplyr,
glue,
lazyeval,
magrittr,
purrr,
readr,
Expand Down
6 changes: 4 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# gutenbergr (development version)

* `gutenberg_get_all_mirrors()` has been added to retrieve mirror data (@jrdnbradford, #58)
* `gutenberg_download()` tries the `.txt` version of files when the `.zip` is unavailable (@jrdnbradford, #55).
* New function `gutenberg_get_all_mirrors()` retrieves all mirror data (@jrdnbradford, #58).
* The package infrastructure has been updated to make the package more robust and maintainable.

# gutenbergr 0.2.4

Expand All @@ -14,7 +16,7 @@

* Updated metadata (#32, #29)
* minor bug fixes and improvements, including removing broken url and updating documentation to comply with CRAN roxygen2 requirements (#30, #31, #35, #28).
* Changed maintainer (#30)
* Changed maintainer (#30).

# gutenbergr 0.2.0

Expand Down
3 changes: 2 additions & 1 deletion R/gutenberg_download.R
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ try_gutenberg_download <- function(url) {
"i" = "The book may have been archived.",
"i" = "Alternatively, You may need to select a different mirror.",
">" = "See https://www.gutenberg.org/MIRRORS.ALL for options."
)
),
class = "gutenbergr-warning-download_failure"
)
}
return(ret)
Expand Down
22 changes: 12 additions & 10 deletions R/gutenberg_works.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,19 @@ gutenberg_works <- function(..., languages = "en",
distinct = TRUE,
all_languages = FALSE,
only_languages = TRUE) {
dots <- lazyeval::lazy_dots(...)
if (length(dots) > 0 && any(names(dots) != "")) {
cli::cli_abort(
c(
x = "We detected a named input.",
i = "Use == expressions, not named arguments.",
i = "For example, use gutenberg_works(author == 'Dickens, Charles'),",
i = "not gutenberg_works(author = 'Dickens, Charles')."
rlang::check_dots_unnamed(
error = function(e) {
cli::cli_abort(
c(
x = "We detected a named input.",
i = "Use == expressions, not named arguments.",
i = "For example, use gutenberg_works(author == 'Dickens, Charles'),",
i = "not gutenberg_works(author = 'Dickens, Charles')."
),
call = rlang::env_parent()
)
)
}
}
)
ret <- filter(gutenberg_metadata, ...)

if (!is.null(languages)) {
Expand Down
1 change: 1 addition & 0 deletions man/gutenbergr-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions tests/testthat/test-gutenberg_download.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,15 @@ test_that("gutenberg_download works", {
)
expect_identical(test_result, gutenbergr::sample_books)
})

test_that("try_gutenberg_download errors informatively with no return", {
local_mocked_bindings(
read_next = function(url) {
return(NULL)
}
)
expect_warning(
try_gutenberg_download("https://example.com"),
class = "gutenbergr-warning-download_failure"
)
})