An open API service indexing awesome lists of open source software.

https://github.com/ThinkR-open/ghooks

'Golem' Hooks for Standard 'Shiny' Apps
https://github.com/ThinkR-open/ghooks

golemverse shiny shiny-apps shiny-r

Last synced: 4 months ago
JSON representation

'Golem' Hooks for Standard 'Shiny' Apps

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# ghooks

[![R-CMD-check](https://github.com/ThinkR-open/ghooks/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ThinkR-open/ghooks/actions/workflows/R-CMD-check.yaml)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)

The goal of `{ghooks}` is to provide `{ghooks}` hooks for standard `{shiny}` apps.

## Installation

You can install the development version of `{ghooks}` like so:

``` r
pak::pak("thinkr-open/ghooks")
```

## About

You're reading the doc about version : `r pkgload::pkg_version()`

This README has been compiled on the

```{r}
Sys.time()
```

Here are the test & coverage results :

```{r}
devtools::check(quiet = TRUE)
```

```{r echo = FALSE}
unloadNamespace("ghooks")
```

```{r}
covr::package_coverage()
```

## `{golem}` hooks

`{golem}` hooks are functions that are called by `{golem}` at specific moments of the app lifecycle.
They are used to add custom code to the app, notably when creating the app with `create_golem()`.

You can find more info about `{golem}` hooks on [`{golem}` documentation](https://thinkr-open.github.io/golem/articles/f_extending_golem.html).

The hooks can be called with `golem::create_golem(project_hook = )`, when creating a new golem project via the RStudio widget, as show on the screenshot in the [Extending `{golem}`](https://thinkr-open.github.io/golem/articles/f_extending_golem.html#defining-your-own-project_hook) Vignette.

Below is the list of curently available hooks:

### `geyser_hook`

This hook is mainly intended at demoing the `{golem}` hooks system.
It adds the "Old Faithful Geyser Data" app to your golem project.

Click here to see the content of `app_ui` and `app_server` from `geyser_hook`

```{r}
pth <- tempfile(pattern = "geyser")
old_wd <- getwd()
unlink(pth, recursive = TRUE)
golem::create_golem(
pth,
project_hook = ghooks::geyser_hook,
open = FALSE
)
```

```{r}
cat(
readLines(
file.path(pth, "R", "app_ui.R")
),
sep = "\n"
)
```

```{r}
cat(
readLines(
file.path(pth, "R", "app_server.R")
),
sep = "\n"
)
```

## About

You're reading the doc about version : `r pkgload::pkg_version()`

This README has been compiled on:

```{r}
Sys.time()
```

Here are the test & coverage results :

```{r}
devtools::check(quiet = TRUE)
```

```{r echo = FALSE}
unloadNamespace("ghooks")
```

```{r}
covr::package_coverage()
```