Skip to content

Commit

Permalink
Fix pkgdown deployment
Browse files Browse the repository at this point in the history
Why? Build pkgdown without ODS credentials
What?
- Add file with example of output from `get_ods_page()`
- Use this file in example chunks for the vignette
  • Loading branch information
marionlouveaux committed Mar 16, 2022
1 parent 3146fc5 commit 18e0896
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 44 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Authors@R: c(
Description: Knit Rmarkdown and send html output on an OpenDataSoft
platform. Request credentials to access the platform.
License: MIT + file LICENSE
URL: https://opendatasoft.github.io/odsrmd/
Imports:
glue,
httr2,
Expand All @@ -28,4 +29,3 @@ VignetteBuilder:
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.2
URL: https://opendatasoft.github.io/odsrmd/
8 changes: 3 additions & 5 deletions R/create_json.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@
#' 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 <- "testthat-odsrmd"
#' body_and_style <- get_body_and_style(path, add_extra_css = "no")
#'
#'
#' body_and_style <- get_body_and_style(path)
#'
#' page_elements <- get_ods_page(page_slug)
#' file.copy(from = system.file("examples/page_elements_example", package = "odsrmd"), to = dir_tmp)
#' page_elements <- readRDS(paste0(dir_tmp, "/page_elements_example"))
#'
#' json_to_send <- create_json(page_elements, body_and_style,
#' chosen_languages = "all",
Expand Down
8 changes: 6 additions & 2 deletions R/get_languages.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
#'
#' @export
#' @examples
#' page_slug <- "testthat-odsrmd"
#' page_elements <- get_ods_page(page_slug)
#' # Temporary directory for reproducible example
#' dir_tmp <- tempfile(pattern = "proj-")
#' dir.create(dir_tmp)
#'
#' file.copy(from = system.file("examples/page_elements_example", package = "odsrmd"), to = dir_tmp)
#' page_elements <- readRDS(paste0(dir_tmp, "/page_elements_example"))
#'
#' all_languages <- get_languages(page_elements)
get_languages <- function(page_elements, verbose = TRUE) {
Expand Down
8 changes: 6 additions & 2 deletions R/is_available.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
#'
#' @export
#' @examples
#' page_slug <- "testthat-odsrmd"
#' page_elements <- get_ods_page(page_slug)
#' # Temporary directory for reproducible example
#' dir_tmp <- tempfile(pattern = "proj-")
#' dir.create(dir_tmp)
#'
#' file.copy(from = system.file("examples/page_elements_example", package = "odsrmd"), to = dir_tmp)
#' page_elements <- readRDS(paste0(dir_tmp, "/page_elements_example"))
#'
#' is_available("EN", page_elements)
is_available <- function(language, page_elements) {
Expand Down
1 change: 0 additions & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ authors:
html: "<img src='https://www.opendatasoft.com/wp-content/uploads/2021/10/logo-mobile.svg' height=24>"

Marion Louveaux:

30 changes: 18 additions & 12 deletions dev/flat_full.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ get_ods_page <- function(page_slug) {
```

```{r example-get_ods_page}
```{r example-get_ods_page, eval=FALSE}
page_slug <- "testthat-odsrmd"
page_elements <- get_ods_page(page_slug)
Expand Down Expand Up @@ -471,8 +471,12 @@ get_languages <- function(page_elements, verbose = TRUE) {
```

```{r example-get_languages}
page_slug <- "testthat-odsrmd"
page_elements <- get_ods_page(page_slug)
# Temporary directory for reproducible example
dir_tmp <- tempfile(pattern = "proj-")
dir.create(dir_tmp)
file.copy(from = system.file("examples/page_elements_example", package = "odsrmd"), to = dir_tmp)
page_elements <- readRDS(paste0(dir_tmp, "/page_elements_example"))
all_languages <- get_languages(page_elements)
```
Expand Down Expand Up @@ -515,8 +519,12 @@ is_available <- function(language, page_elements) {
```

```{r example-is_available}
page_slug <- "testthat-odsrmd"
page_elements <- get_ods_page(page_slug)
# Temporary directory for reproducible example
dir_tmp <- tempfile(pattern = "proj-")
dir.create(dir_tmp)
file.copy(from = system.file("examples/page_elements_example", package = "odsrmd"), to = dir_tmp)
page_elements <- readRDS(paste0(dir_tmp, "/page_elements_example"))
is_available("EN", page_elements)
```
Expand Down Expand Up @@ -741,12 +749,10 @@ file.copy(from = system.file("examples/example_rmd.Rmd", package = "odsrmd"), to
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 <- "testthat-odsrmd"
body_and_style <- get_body_and_style(path)
body_and_style <- get_body_and_style(path, add_extra_css = "no")
page_elements <- get_ods_page(page_slug)
file.copy(from = system.file("examples/page_elements_example", package = "odsrmd"), to = dir_tmp)
page_elements <- readRDS(paste0(dir_tmp, "/page_elements_example"))
json_to_send <- create_json(page_elements, body_and_style,
chosen_languages = "all",
Expand Down Expand Up @@ -869,7 +875,7 @@ put_ods_page <- function(page_slug, json_to_send) {
```

```{r example-put_ods_page}
```{r example-put_ods_page, eval=FALSE}
# Temporary directory for reproducible example
dir_tmp <- tempfile(pattern = "proj-")
dir.create(dir_tmp)
Expand Down Expand Up @@ -953,7 +959,7 @@ put_ods_page(page_slug, json_to_send)
}
```

```{r example-update_ods_page}
```{r example-update_ods_page, eval=FALSE}
# Temporary directory for reproducible example
dir_tmp <- tempfile(pattern = "proj-")
dir.create(dir_tmp)
Expand Down
Binary file added inst/examples/page_elements_example
Binary file not shown.
8 changes: 3 additions & 5 deletions man/create_json.Rd

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

8 changes: 6 additions & 2 deletions man/get_languages.Rd

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

8 changes: 6 additions & 2 deletions man/is_available.Rd

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

30 changes: 18 additions & 12 deletions vignettes/get-started.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ The get_ods_page() function gets all pre-existing information of the page, such



```{r example-get_ods_page}
```{r example-get_ods_page, eval = FALSE}
page_slug <- "testthat-odsrmd"
page_elements <- get_ods_page(page_slug)
Expand All @@ -179,8 +179,12 @@ page_elements <- get_ods_page(page_slug)


```{r example-get_languages}
page_slug <- "testthat-odsrmd"
page_elements <- get_ods_page(page_slug)
# Temporary directory for reproducible example
dir_tmp <- tempfile(pattern = "proj-")
dir.create(dir_tmp)
file.copy(from = system.file("examples/page_elements_example", package = "odsrmd"), to = dir_tmp)
page_elements <- readRDS(paste0(dir_tmp, "/page_elements_example"))
all_languages <- get_languages(page_elements)
```
Expand All @@ -197,8 +201,12 @@ all_languages <- get_languages(page_elements)


```{r example-is_available}
page_slug <- "testthat-odsrmd"
page_elements <- get_ods_page(page_slug)
# Temporary directory for reproducible example
dir_tmp <- tempfile(pattern = "proj-")
dir.create(dir_tmp)
file.copy(from = system.file("examples/page_elements_example", package = "odsrmd"), to = dir_tmp)
page_elements <- readRDS(paste0(dir_tmp, "/page_elements_example"))
is_available("EN", page_elements)
```
Expand Down Expand Up @@ -227,12 +235,10 @@ file.copy(from = system.file("examples/example_rmd.Rmd", package = "odsrmd"), to
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 <- "testthat-odsrmd"
body_and_style <- get_body_and_style(path)
body_and_style <- get_body_and_style(path, add_extra_css = "no")
page_elements <- get_ods_page(page_slug)
file.copy(from = system.file("examples/page_elements_example", package = "odsrmd"), to = dir_tmp)
page_elements <- readRDS(paste0(dir_tmp, "/page_elements_example"))
json_to_send <- create_json(page_elements, body_and_style,
chosen_languages = "all",
Expand All @@ -252,7 +258,7 @@ put_ods_page() updates the content of the page on the Opendatasoft platform with



```{r example-put_ods_page}
```{r example-put_ods_page, eval = FALSE}
# Temporary directory for reproducible example
dir_tmp <- tempfile(pattern = "proj-")
dir.create(dir_tmp)
Expand Down Expand Up @@ -288,7 +294,7 @@ put_ods_page(page_slug, json_to_send)



```{r example-update_ods_page}
```{r example-update_ods_page, eval = FALSE}
# Temporary directory for reproducible example
dir_tmp <- tempfile(pattern = "proj-")
dir.create(dir_tmp)
Expand Down

0 comments on commit 18e0896

Please sign in to comment.