Skip to content

Commit dcc3d03

Browse files
committed
chore: do not run examples
Disable examples entirely in order to prevent them from being executed on CRAN. They were run before with `\donttest` which has been overridden by the option `--run-donttest`.
1 parent ac9f31e commit dcc3d03

19 files changed

+116
-47
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: openrouteservice
22
Title: An 'openrouteservice' API Client
3-
Version: 0.6.1
3+
Version: 0.6.2
44
Authors@R: c(
55
person("Heidelberg Institute for Geoinformation Technology (HeiGIT) gGmbH", role = "cph"),
66
person(c("Andrzej", "K."), "Oleś", email = "andrzej.oles@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-0285-2787"))

R/api_key.R

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ ors_api_key <- function (key, service = 'openrouteservice', username = NULL, key
3131
## api key set in environment variable takes precedence over keyring
3232
if ( nchar(api_key_val) )
3333
api_key_val
34-
else
35-
if ( isTRUE(grepl("^https?://api.openrouteservice.org$", ors_url())) )
36-
tryCatch(
37-
key_get(service, username, keyring),
38-
error = function(e)
39-
stop(sprintf("API key not set.\n Get your free key at %s\n Use `ors_api_key('<your-api-key>')` to set it", signup_url()), call. = FALSE))
34+
else if ( on_cran() )
35+
NA
36+
else if ( isTRUE(grepl("^https?://api.openrouteservice.org$", ors_url())) )
37+
tryCatch(
38+
key_get(service, username, keyring),
39+
error = function(e)
40+
stop(sprintf("API key not set.\n Get your free key at %s\n Use `ors_api_key('<your-api-key>')` to set it", signup_url()), call. = FALSE))
4041
}
4142
## set key
4243
else

R/directions.R

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,22 @@
1616
#' @template return-parsed
1717
#' @template return-sf
1818
#' @examples
19-
#' \donttest{coordinates <- list(c(8.34234, 48.23424), c(8.34423, 48.26424))
19+
#' # These examples might require interaction to query the local keyring, or
20+
#' # might fail due to network issues, so they are not run by default
21+
#' \dontrun{
22+
#' coordinates <- list(c(8.34234, 48.23424), c(8.34423, 48.26424))
2023
#'
2124
#' # simple call
22-
#' ors_directions(coordinates, preference="fastest")
25+
#' try( ors_directions(coordinates, preference="fastest") )
2326
#'
2427
#' # customized options
25-
#' ors_directions(coordinates, profile="cycling-mountain", elevation=TRUE)
28+
#' try( ors_directions(coordinates, profile="cycling-mountain", elevation=TRUE) )
2629
#'
2730
#' # list of locations as `data.frame` output as simple features `sf` object
2831
#' locations <- data.frame(lng = c(8.34234, 8.327807, 8.34423),
2932
#' lat = c(48.23424, 48.239368, 48.26424))
30-
#' ors_directions(locations, output = "sf")}
33+
#' try( ors_directions(locations, output = "sf") )
34+
#' }
3135
#' @template author
3236
#' @export
3337
ors_directions <- function(coordinates,

R/elevation.R

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,24 @@
1717
#' @template return-parsed
1818
#' @template return-sf
1919
#' @examples
20-
#' \donttest{# point coordinates
20+
#' # These examples might require interaction to query the local keyring, or
21+
#' # might fail due to network issues, so they are not run by default
22+
#' \dontrun{
23+
#' # point coordinates
2124
#' coordinates <- c(13.349762, 38.11295)
22-
#' ors_elevation("point", coordinates)
25+
#' try( ors_elevation("point", coordinates) )
2326
#'
2427
#' # geojson as input
2528
#' point <- '{ "type": "Point", "coordinates": [13.349762, 38.11295] }'
26-
#' ors_elevation("geojson", point)
29+
#' try( ors_elevation("geojson", point) )
2730
#'
2831
#' # line geometry returned as encoded polyline
2932
#' coordinates <- list(
3033
#' c(13.349762, 38.11295),
3134
#' c(12.638397, 37.645772)
3235
#' )
33-
#' ors_elevation("polyline", coordinates, format_out = "encodedpolyline")}
36+
#' try( ors_elevation("polyline", coordinates, format_out = "encodedpolyline") )
37+
#' }
3438
#' @template author
3539
#' @importFrom httr add_headers
3640
#' @export

R/geocode.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
#' tag which surrounds the given coordinate.
2020
#' @template author
2121
#' @examples
22-
#' \donttest{## locations of Heidelberg around the globe
22+
#' # These examples might require interaction to query the local keyring, or
23+
#' # might fail due to network issues, so they are not run by default
24+
#' \dontrun{
25+
#' ## locations of Heidelberg around the globe
2326
#' x <- ors_geocode("Heidelberg")
2427
#'
2528
#' ## set the number of results returned
@@ -33,7 +36,8 @@
3336
#'
3437
#' ## reverse geocoding
3538
#' location <- x$features[[1L]]$geometry$coordinates
36-
#' y <- ors_geocode(location = location, layers = "locality", size = 1)}
39+
#' y <- ors_geocode(location = location, layers = "locality", size = 1)
40+
#' }
3741
#' @export
3842
ors_geocode <- function(query,
3943
location,

R/isochrones.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,14 @@
2222
#' @template return-parsed
2323
#' @template return-sf
2424
#' @examples
25-
#' \donttest{ors_isochrones(c(8.34234, 48.23424), interval=20)
25+
#' # These examples might require interaction to query the local keyring, or
26+
#' # might fail due to network issues, so they are not run by default
27+
#' \dontrun{
28+
#' ors_isochrones(c(8.34234, 48.23424), interval=20)
2629
#'
2730
#' locations <- list(c(8.681495, 49.41461), c(8.686507,49.41943))
28-
#' ors_isochrones(locations, range=c(300, 200))}
31+
#' ors_isochrones(locations, range=c(300, 200))
32+
#' }
2933
#' @template author
3034
#' @export
3135
ors_isochrones <- function(locations,

R/matrix.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
#' @template return-text
1616
#' @template return-parsed
1717
#' @examples
18-
#' \donttest{coordinates <- list(
18+
#' # These examples might require interaction to query the local keyring, or
19+
#' # might fail due to network issues, so they are not run by default
20+
#' \dontrun{
21+
#' coordinates <- list(
1922
#' c(9.970093, 48.477473),
2023
#' c(9.207916, 49.153868),
2124
#' c(37.573242, 55.801281),
@@ -29,7 +32,8 @@
2932
#' res$durations / 3600
3033
#'
3134
#' # distance in km
32-
#' res$distances}
35+
#' res$distances
36+
#' }
3337
#' @template author
3438
#' @export
3539
ors_matrix <- function(locations,

R/optimization.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
#' @template return-text
1717
#' @template return-parsed
1818
#' @examples
19-
#' \donttest{home_base <- c(2.35044, 48.71764)
19+
#' # These examples might require interaction to query the local keyring, or
20+
#' # might fail due to network issues, so they are not run by default
21+
#' \dontrun{
22+
#' home_base <- c(2.35044, 48.71764)
2023
#'
2124
#' vehicles <- vehicles(
2225
#' id = 1:2,
@@ -45,7 +48,8 @@
4548
#' skills = list(1, 1, 2, 2, 14, 14)
4649
#' )
4750
#'
48-
#' ors_optimization(jobs, vehicles)}
51+
#' try( ors_optimization(jobs, vehicles) )
52+
#' }
4953
#' @template author
5054
#' @export
5155
ors_optimization <- function(jobs,

R/pois.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
#' @template return-sf
2525
#' @templateVar valid_for `request = "pois"`
2626
#' @examples
27-
#' \donttest{# POI categories list
27+
#' # These examples might require interaction to query the local keyring, or
28+
#' # might fail due to network issues, so they are not run by default
29+
#' \dontrun{
30+
#' # POI categories list
2831
#' ors_pois('list')
2932
#'
3033
#' # POIs around a buffered point
@@ -54,7 +57,8 @@
5457
#' ))
5558
#'
5659
#' # POI Statistics
57-
#' ors_pois("stats", geometry = geometry)}
60+
#' ors_pois("stats", geometry = geometry)
61+
#' }
5862
#' @template author
5963
#' @export
6064
ors_pois <- function(request = c('pois', 'stats', 'list'),

R/snap.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,18 @@
1616
#' @template return-parsed
1717
#' @template return-sf
1818
#' @examples
19-
#' \donttest{locations <- list(
19+
#' # These examples might require interaction to query the local keyring, or
20+
#' # might fail due to network issues, so they are not run by default
21+
#' \dontrun{
22+
#' locations <- list(
2023
#' c(8.669629, 49.413025),
2124
#' c(8.675841, 49.418532),
2225
#' c(8.665144, 49.415594)
2326
#' )
2427
#'
2528
#' # query for locations snapped onto the OpenStreetMap road network
26-
#' res <- ors_snap(locations, radius = 350)}
29+
#' res <- ors_snap(locations, radius = 350)
30+
#' }
2731
#' @template author
2832
#' @export
2933
ors_snap <- function(locations,

0 commit comments

Comments
 (0)