Skip to content

Commit

Permalink
update missing phantomjs dep, fix #63
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyhanson committed Oct 15, 2022
1 parent beac292 commit cc0cc41
Show file tree
Hide file tree
Showing 24 changed files with 50 additions and 42 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: wdpar
Type: Package
Version: 1.3.3.2
Version: 1.3.3.3
Title: Interface to the World Database on Protected Areas
Description: Fetch and clean data from the World Database on Protected
Areas (WDPA) and the World Database on Other Effective Area-Based
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# wdpar 1.3.3.3

- Improve error message for `wdpa_fetch()` when PhantomJS is not
installed (#63).

# wdpar 1.3.3.2

- Add URLs to README for citations (#58).
Expand Down
26 changes: 13 additions & 13 deletions R/wdpa_url.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,15 @@ wdpa_url <- function(x, wait = FALSE, page_wait = 2) {
assertthat::is.flag(wait),
assertthat::is.count(page_wait),
assertthat::noNA(page_wait),
is_online(),
has_phantomjs(silent = FALSE))
is_online()
)
assertthat::assert_that(
has_phantomjs(),
msg = paste0(
"cannot find PhantomJS; please install it using: ",
"webdriver::install_phantomjs()"
)
)
# declare hidden function
try_and_find_url <- function(x) {
## initialize web driver
Expand Down Expand Up @@ -144,7 +151,7 @@ start_phantomjs <- function() {
pjs <- webdriver::run_phantomjs()
)
} else {
pjs <- webdriver::run_phantomjs()
pjs <- suppressMessages(webdriver::run_phantomjs())
}
# return object
pjs
Expand All @@ -155,15 +162,8 @@ stop_phantomjs <- function(pjs) {
try(pjs$process$kill(), silent = TRUE)
}

has_phantomjs <- function(silent = TRUE) {
assertthat::assert_that(
assertthat::is.flag(silent),
assertthat::noNA(silent)
)
pjs <- try(start_phantomjs, silent = TRUE)
on.exit(stop_phantomjs(pjs))
if (inherits(pjs, "try-error") && !isTRUE(silent)) {
stop(pjs)
}
has_phantomjs <- function() {
pjs <- suppressMessages(try(start_phantomjs(), silent = TRUE))
on.exit(suppressMessages(stop_phantomjs(pjs)))
!inherits(pjs, "try-error")
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ To cite the latest official version, please use:
To cite the latest development version, please use:

> Hanson JO (2022). wdpar: Interface to the World Database on Protected
> Areas. R package version 1.3.3.2. Available at
> Areas. R package version 1.3.3.3. Available at
> <https://github.com/prioritizr/wdpar>.
To cite the World Database on Protected Areas (WDPA), please use:
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html

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

2 changes: 1 addition & 1 deletion docs/CONTRIBUTING.html

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

2 changes: 1 addition & 1 deletion docs/LICENSE-text.html

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

2 changes: 1 addition & 1 deletion docs/articles/index.html

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

4 changes: 2 additions & 2 deletions docs/articles/wdpar.html

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

6 changes: 3 additions & 3 deletions docs/authors.html

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

4 changes: 2 additions & 2 deletions docs/index.html

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

5 changes: 4 additions & 1 deletion docs/news/index.html

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

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ pkgdown: 2.0.6
pkgdown_sha: ~
articles:
wdpar: wdpar.html
last_built: 2022-09-28T15:15Z
last_built: 2022-10-15T19:50Z

2 changes: 1 addition & 1 deletion docs/reference/index.html

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

2 changes: 1 addition & 1 deletion docs/reference/st_erase_overlaps.html

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

2 changes: 1 addition & 1 deletion docs/reference/st_repair_geometry.html

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

2 changes: 1 addition & 1 deletion docs/reference/wdpa_clean.html

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

2 changes: 1 addition & 1 deletion docs/reference/wdpa_dissolve.html

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

2 changes: 1 addition & 1 deletion docs/reference/wdpa_fetch.html

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

2 changes: 1 addition & 1 deletion docs/reference/wdpa_latest_version.html

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

2 changes: 1 addition & 1 deletion docs/reference/wdpa_read.html

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

6 changes: 3 additions & 3 deletions docs/reference/wdpa_url.html

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

2 changes: 1 addition & 1 deletion docs/reference/wdpar.html

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

4 changes: 2 additions & 2 deletions inst/doc/wdpar.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<meta name="author" content="Jeffrey O. Hanson" />

<meta name="date" content="2022-09-28" />
<meta name="date" content="2022-10-16" />

<title>wdpar: Interface to the World Database on Protected Areas</title>

Expand Down Expand Up @@ -149,7 +149,7 @@

<h1 class="title toc-ignore">wdpar: Interface to the World Database on Protected Areas</h1>
<h4 class="author">Jeffrey O. Hanson</h4>
<h4 class="date">2022-09-28</h4>
<h4 class="date">2022-10-16</h4>



Expand Down

0 comments on commit cc0cc41

Please sign in to comment.