Skip to content

Commit

Permalink
Improve pkgdown deployment
Browse files Browse the repository at this point in the history
Why? Examples that require credentials throw an error message.
What? Silence these examples with dontrun.
  • Loading branch information
marionlouveaux committed Mar 16, 2022
1 parent feb675c commit 3772e38
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 72 deletions.
3 changes: 2 additions & 1 deletion R/get_ods_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
#'
#' @export
#' @examples
#' \dontrun{
#' page_slug <- "odsrmd-example"
#' page_elements <- get_ods_page(page_slug)
#'
#' }
get_ods_page <- function(page_slug) {
if (page_slug == "") {
stop(
Expand Down
2 changes: 2 additions & 0 deletions R/put_ods_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#'
#' @export
#' @examples
#' \dontrun{
#' # Temporary directory for reproducible example
#' dir_tmp <- tempfile(pattern = "proj-")
#' dir.create(dir_tmp)
Expand All @@ -31,6 +32,7 @@
#' tags = NULL, restricted = NULL)
#'
#' put_ods_page(page_slug, json_to_send)
#' }
put_ods_page <- function(page_slug, json_to_send) {
if (page_slug == "") {
stop(
Expand Down
2 changes: 2 additions & 0 deletions R/update_ods_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#'
#' @export
#' @examples
#' \dontrun{
#' # Temporary directory for reproducible example
#' dir_tmp <- tempfile(pattern = "proj-")
#' dir.create(dir_tmp)
Expand All @@ -26,6 +27,7 @@
#' update_ods_page(path, page_slug, add_extra_css = "no", chosen_languages = "all", title = NULL,
#' description = NULL, tags = NULL, restricted = NULL
#' )
#' }
update_ods_page <- function(path, page_slug, add_extra_css = "no", chosen_languages = "all", title = NULL,
description = NULL, tags = NULL, restricted = NULL){

Expand Down
75 changes: 40 additions & 35 deletions dev/flat_full.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,10 @@ get_ods_page <- function(page_slug) {
```

```{r example-get_ods_page, eval=FALSE}
page_slug <- "odsrmd-example"
page_elements <- get_ods_page(page_slug)
#' \dontrun{
#' page_slug <- "odsrmd-example"
#' page_elements <- get_ods_page(page_slug)
#' }
```

```{r tests-get_ods_page}
Expand Down Expand Up @@ -878,25 +879,27 @@ put_ods_page <- function(page_slug, json_to_send) {
```

```{r example-put_ods_page, eval=FALSE}
# Temporary directory for reproducible example
dir_tmp <- tempfile(pattern = "proj-")
dir.create(dir_tmp)
file.copy(from = system.file("examples/example_rmd.Rmd", package = "odsrmd"), to=dir_tmp)
file.copy(from = system.file("examples/style.css", package = "odsrmd"), to=dir_tmp)
# browseURL(dir_tmp)
path <- paste0(dir_tmp, "/example_rmd.Rmd")
page_slug <- "odsrmd-example"
body_and_style <- get_body_and_style(path)
page_elements <- get_ods_page(page_slug)
json_to_send <- create_json(page_elements, body_and_style, chosen_languages = c("en", "fr"),
title = "English title", description = NULL,
tags = NULL, restricted = NULL)
put_ods_page(page_slug, json_to_send)
#' \dontrun{
#' # Temporary directory for reproducible example
#' dir_tmp <- tempfile(pattern = "proj-")
#' dir.create(dir_tmp)
#'
#' file.copy(from = system.file("examples/example_rmd.Rmd", package = "odsrmd"), to=dir_tmp)
#' file.copy(from = system.file("examples/style.css", package = "odsrmd"), to=dir_tmp)
#' # browseURL(dir_tmp)
#' path <- paste0(dir_tmp, "/example_rmd.Rmd")
#' page_slug <- "odsrmd-example"
#'
#' body_and_style <- get_body_and_style(path)
#'
#' page_elements <- get_ods_page(page_slug)
#'
#' json_to_send <- create_json(page_elements, body_and_style, chosen_languages = c("en", "fr"),
#' title = "English title", description = NULL,
#' tags = NULL, restricted = NULL)
#'
#' put_ods_page(page_slug, json_to_send)
#' }
```

```{r tests-put_ods_page}
Expand Down Expand Up @@ -960,19 +963,21 @@ put_ods_page(page_slug, json_to_send)
```

```{r example-update_ods_page, eval=FALSE}
# Temporary directory for reproducible example
dir_tmp <- tempfile(pattern = "proj-")
dir.create(dir_tmp)
file.copy(from = system.file("examples/example_rmd.Rmd", package = "odsrmd"), to = dir_tmp)
file.copy(from = system.file("examples/style.css", package = "odsrmd"), to=dir_tmp)
# browseURL(dir_tmp)
path <- paste0(dir_tmp, "/example_rmd.Rmd")
page_slug <- "odsrmd-example"
update_ods_page(path, page_slug, add_extra_css = "no", chosen_languages = "all", title = NULL,
description = NULL, tags = NULL, restricted = NULL
)
#' \dontrun{
#' # Temporary directory for reproducible example
#' dir_tmp <- tempfile(pattern = "proj-")
#' dir.create(dir_tmp)
#'
#' file.copy(from = system.file("examples/example_rmd.Rmd", package = "odsrmd"), to = dir_tmp)
#' file.copy(from = system.file("examples/style.css", package = "odsrmd"), to=dir_tmp)
#' # browseURL(dir_tmp)
#' path <- paste0(dir_tmp, "/example_rmd.Rmd")
#' page_slug <- "odsrmd-example"
#'
#' update_ods_page(path, page_slug, add_extra_css = "no", chosen_languages = "all", title = NULL,
#' description = NULL, tags = NULL, restricted = NULL
#' )
#' }
```

```{r tests-update_ods_page}
Expand Down
3 changes: 2 additions & 1 deletion man/get_ods_page.Rd

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

2 changes: 2 additions & 0 deletions man/put_ods_page.Rd

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

2 changes: 2 additions & 0 deletions man/update_ods_page.Rd

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

75 changes: 40 additions & 35 deletions vignettes/get-started.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,10 @@ body_and_style <- get_body_and_style(path, add_extra_css = "no")


```{r example-get_ods_page, eval = FALSE}
page_slug <- "odsrmd-example"
page_elements <- get_ods_page(page_slug)
#' \dontrun{
#' page_slug <- "odsrmd-example"
#' page_elements <- get_ods_page(page_slug)
#' }
```


Expand Down Expand Up @@ -259,25 +260,27 @@ json_to_send <- create_json(page_elements, body_and_style,


```{r example-put_ods_page, eval = FALSE}
# Temporary directory for reproducible example
dir_tmp <- tempfile(pattern = "proj-")
dir.create(dir_tmp)
file.copy(from = system.file("examples/example_rmd.Rmd", package = "odsrmd"), to=dir_tmp)
file.copy(from = system.file("examples/style.css", package = "odsrmd"), to=dir_tmp)
# browseURL(dir_tmp)
path <- paste0(dir_tmp, "/example_rmd.Rmd")
page_slug <- "odsrmd-example"
body_and_style <- get_body_and_style(path)
page_elements <- get_ods_page(page_slug)
json_to_send <- create_json(page_elements, body_and_style, chosen_languages = c("en", "fr"),
title = "English title", description = NULL,
tags = NULL, restricted = NULL)
put_ods_page(page_slug, json_to_send)
#' \dontrun{
#' # Temporary directory for reproducible example
#' dir_tmp <- tempfile(pattern = "proj-")
#' dir.create(dir_tmp)
#'
#' file.copy(from = system.file("examples/example_rmd.Rmd", package = "odsrmd"), to=dir_tmp)
#' file.copy(from = system.file("examples/style.css", package = "odsrmd"), to=dir_tmp)
#' # browseURL(dir_tmp)
#' path <- paste0(dir_tmp, "/example_rmd.Rmd")
#' page_slug <- "odsrmd-example"
#'
#' body_and_style <- get_body_and_style(path)
#'
#' page_elements <- get_ods_page(page_slug)
#'
#' json_to_send <- create_json(page_elements, body_and_style, chosen_languages = c("en", "fr"),
#' title = "English title", description = NULL,
#' tags = NULL, restricted = NULL)
#'
#' put_ods_page(page_slug, json_to_send)
#' }
```


Expand All @@ -293,19 +296,21 @@ put_ods_page(page_slug, json_to_send)


```{r example-update_ods_page, eval = FALSE}
# Temporary directory for reproducible example
dir_tmp <- tempfile(pattern = "proj-")
dir.create(dir_tmp)
file.copy(from = system.file("examples/example_rmd.Rmd", package = "odsrmd"), to = dir_tmp)
file.copy(from = system.file("examples/style.css", package = "odsrmd"), to=dir_tmp)
# browseURL(dir_tmp)
path <- paste0(dir_tmp, "/example_rmd.Rmd")
page_slug <- "odsrmd-example"
update_ods_page(path, page_slug, add_extra_css = "no", chosen_languages = "all", title = NULL,
description = NULL, tags = NULL, restricted = NULL
)
#' \dontrun{
#' # Temporary directory for reproducible example
#' dir_tmp <- tempfile(pattern = "proj-")
#' dir.create(dir_tmp)
#'
#' file.copy(from = system.file("examples/example_rmd.Rmd", package = "odsrmd"), to = dir_tmp)
#' file.copy(from = system.file("examples/style.css", package = "odsrmd"), to=dir_tmp)
#' # browseURL(dir_tmp)
#' path <- paste0(dir_tmp, "/example_rmd.Rmd")
#' page_slug <- "odsrmd-example"
#'
#' update_ods_page(path, page_slug, add_extra_css = "no", chosen_languages = "all", title = NULL,
#' description = NULL, tags = NULL, restricted = NULL
#' )
#' }
```


Expand Down

0 comments on commit 3772e38

Please sign in to comment.