Skip to content

Commit 64f7976

Browse files
committed
Clean up README and vignettes
1 parent 3fce356 commit 64f7976

File tree

3 files changed

+48
-43
lines changed

3 files changed

+48
-43
lines changed

README.Rmd

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ knitr::opts_chunk$set(
1414
)
1515
```
1616

17-
# multideploy <img src="man/figures/multideploy-logo.svg" align="right" height="139" />
17+
# multideploy <img src="man/figures/multideploy-logo.svg" align="right" width="139" alt="a hex logo for the multideploy R package" />
1818

1919
<!-- badges: start -->
2020
[![R-CMD-check](https://github.com/coatless-rpkg/multideploy/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/coatless-rpkg/multideploy/actions/workflows/R-CMD-check.yaml)
@@ -27,7 +27,9 @@ The `multideploy` package provides tools for deploying file changes across multi
2727

2828
You can install the development version of `multideploy` from [GitHub](https://github.comcoatless-rpkg/multideploy) with:
2929

30-
```r
30+
```{r}
31+
#| label: setup-readme
32+
#| eval: false
3133
# install.packages("remotes")
3234
remotes::install_github("coatless-rpkg/multideploy")
3335
```
@@ -38,19 +40,28 @@ remotes::install_github("coatless-rpkg/multideploy")
3840
GitHub API authentication and querying. Before using `multideploy`, make sure
3941
you have a GitHub Personal Access Token (PAT) set up:
4042

41-
```r
43+
```{r}
44+
#| label: auth-session-readme
45+
#| eval: false
4246
# Set GitHub PAT (or use .Renviron)
4347
Sys.setenv(GITHUB_PAT = askpass::askpass("What is your GitHub Personal Access Token (PAT)?"))
4448
```
4549

46-
It's recommended to store your PAT in your `.Renviron` file rather than in your code.
50+
For regular use, it's recommended to add your PAT to the git credential system
51+
through the `gitcreds` package:
52+
53+
```{r}
54+
#| label: auth-credentials-readme
55+
#| eval: false
56+
gitcreds::gitcreds_set()
57+
```
4758

4859
## Quick Start Example
4960

5061
Here's an example showing how to deploy a standardized CI workflow file to multiple repositories using `multideploy`:
5162

5263
```{r}
53-
#| label: quick-example
64+
#| label: quick-example-readme
5465
#| eval: false
5566
library(multideploy)
5667
@@ -83,7 +94,7 @@ step through the additional features of the package within this section.
8394
List and filter repositories across users or organizations:
8495

8596
```{r}
86-
#| label: repo-listing
97+
#| label: repo-listing-readme-demo
8798
#| eval: false
8899
# Get all public repositories for a user
89100
user_repos <- repos("username", type = "public")
@@ -100,7 +111,7 @@ my_orgs <- orgs()
100111
Deploy individual files or sets of files to multiple repositories:
101112

102113
```{r}
103-
#| label: file-deploy
114+
#| label: file-deploy-readme-demo
104115
#| eval: false
105116
# Deploy a single file
106117
file_deploy("local/path/file.R", "remote/path/file.R", repos)
@@ -129,7 +140,7 @@ pr_create(
129140
Preview changes before making them:
130141

131142
```{r}
132-
#| label: dry-run
143+
#| label: dry-run-readme-demo
133144
#| eval: false
134145
# Preview changes without making them
135146
file_deploy("local/file.R", "remote/file.R", repos, dry_run = TRUE)

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
<!-- README.md is generated from README.Rmd. Please edit that file -->
33

4-
# multideploy <img src="man/figures/multideploy-logo.svg" align="right" height="139" />
4+
# multideploy <img src="man/figures/multideploy-logo.svg" align="right" width="139" alt="a hex logo for the multideploy R package" />
55

66
<!-- badges: start -->
77

@@ -36,8 +36,12 @@ sure you have a GitHub Personal Access Token (PAT) set up:
3636
Sys.setenv(GITHUB_PAT = askpass::askpass("What is your GitHub Personal Access Token (PAT)?"))
3737
```
3838

39-
It’s recommended to store your PAT in your `.Renviron` file rather than
40-
in your code.
39+
For regular use, it’s recommended to add your PAT to the git credential
40+
system through the `gitcreds` package:
41+
42+
``` r
43+
gitcreds::gitcreds_set()
44+
```
4145

4246
## Quick Start Example
4347

vignettes/multideploy.Rmd

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,33 @@ knitr::opts_chunk$set(
1717

1818
## Introduction
1919

20-
The `multideploy` package provides a streamlined way to deploy file changes
20+
The `{multideploy}` package provides a streamlined way to deploy file changes
2121
across multiple GitHub repositories. Whether you're managing standardized CI/CD
2222
configurations, common utility scripts, code style definitions, or any other
23-
files that should be consistent across repositories, `multideploy` helps
23+
files that should be consistent across repositories, `{multideploy}` helps
2424
automate this process.
2525

2626
This vignette will guide you through the main functionality of the package with
2727
practical examples.
2828

2929
## Setup and Authentication
3030

31-
First, load the multideploy package:
31+
First, load the `{multideploy}` package:
3232

3333
```{r}
34-
#| label: setup
34+
#| label: setup-vignette
3535
#| eval: FALSE
3636
library(multideploy)
3737
```
3838

39-
Before using `multideploy`, you need to authenticate with GitHub. The package
39+
Before using `{multideploy}`, you need to authenticate with GitHub. The package
4040
uses the [`gh`](https://github.com/r-lib/gh) package for authentication, which
4141
looks for a [GitHub Personal Access Token (PAT)](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic) in the `GITHUB_PAT` or
4242
`GITHUB_TOKEN` environment variables. This token can be set directly within the
4343
R script via:
4444

4545
```{r}
46-
#| label: auth
46+
#| label: auth-session-vignette
4747
#| eval: FALSE
4848
# Set GitHub PAT (or better, use .Renviron)
4949
Sys.setenv(GITHUB_PAT = askpass::askpass("What is your GitHub Personal Access Token (PAT) ?"))
@@ -52,22 +52,12 @@ Sys.setenv(GITHUB_PAT = askpass::askpass("What is your GitHub Personal Access To
5252
For regular use, it's recommended to add your PAT to the git credential system
5353
through the `gitcreds` package:
5454

55-
```r
55+
```{r}
56+
#| label: auth-credentials-vignette
57+
#| eval: false
5658
gitcreds::gitcreds_set()
5759
```
5860

59-
Alternatively, you can set the PAT directly in your `.Renviron` file by running:
60-
61-
```r
62-
file.edit("~/.Renviron")
63-
```
64-
65-
Then, type:
66-
67-
```bash
68-
GITHUB_PAT=your_github_pat_here
69-
```
70-
7161
Your PAT needs appropriate permissions to access and modify repositories.
7262
At a minimum, you'll need:
7363

@@ -81,7 +71,7 @@ At a minimum, you'll need:
8171
The `repos()` function allows you to list repositories for a user or organization:
8272

8373
```{r}
84-
#| label: repos
74+
#| label: repos-list-vignette
8575
#| eval: FALSE
8676
# List repositories for a user
8777
user_repos <- repos("username")
@@ -101,7 +91,7 @@ head(api_repos)
10191
If you're a member of multiple organizations, you can list them with:
10292

10393
```{r orgs}
104-
#| label: orgs
94+
#| label: orgs-list-vignette
10595
#| eval: FALSE
10696
my_orgs <- orgs()
10797
print(my_orgs)
@@ -114,7 +104,7 @@ print(my_orgs)
114104
You can retrieve the content of a file from a GitHub repository:
115105

116106
```{r}
117-
#| label: file-content
107+
#| label: file-content-vignette
118108
#| eval: FALSE
119109
# Get content of a file
120110
workflow_file <- file_content("username/repo", ".github/workflows/ci.yml")
@@ -128,7 +118,7 @@ cat(workflow_file$content)
128118
To create or update a file in a repository:
129119

130120
```{r}
131-
#| label: file-update
121+
#| label: file-update-vignette
132122
#| eval: FALSE
133123
# Update a file
134124
result <- file_update(
@@ -141,14 +131,14 @@ result <- file_update(
141131

142132
## Deploying Files Across Repositories
143133

144-
The core functionality of `multideploy` is deploying files across multiple repositories. This can be done in two ways:
134+
The core functionality of `{multideploy}` is deploying files across multiple repositories. This can be done in two ways:
145135

146136
### Direct File Deployment
147137

148138
Deploy a single file to multiple repositories:
149139

150140
```{r}
151-
#| label: file-deploy
141+
#| label: file-deploy-vignette
152142
#| eval: FALSE
153143
# Get repositories
154144
repos <- repos("orgname", filter_regex = "^api-")
@@ -170,7 +160,7 @@ print(results)
170160
For changes that require review, you can create pull requests:
171161

172162
```{r}
173-
#| label: file-mapping-and-pull-requests
163+
#| label: file-mapping-and-pull-requests-vignette
174164
#| eval: FALSE
175165
# Create a mapping of files to deploy
176166
mapping <- file_mapping(
@@ -199,7 +189,7 @@ print(pr_results)
199189
You can deploy all files from a directory while preserving their structure:
200190

201191
```{r}
202-
#| label: dir-mapping
192+
#| label: dir-mapping-vignette
203193
#| eval: FALSE
204194
# Create mapping from a directory
205195
workflow_mapping <- file_mapping(
@@ -224,7 +214,7 @@ pr_create(
224214
Before making actual changes, you can preview them using dry run mode:
225215

226216
```{r}
227-
#| label: dry-run
217+
#| label: dry-run-vignette
228218
#| eval: FALSE
229219
# Preview file deployment without making changes
230220
dry_results <- file_deploy(
@@ -243,7 +233,7 @@ print(dry_results)
243233
You can combine repository filtering with deployment to target specific subsets of repositories:
244234

245235
```{r targeting}
246-
#| label: target-repos
236+
#| label: target-repos-vignette
247237
#| eval: FALSE
248238
# Get all organization repositories
249239
all_repos <- repos("orgname")
@@ -296,7 +286,7 @@ example script that updates CI/CD workflows and deploys configuration files to
296286
all repositories in an organization:
297287

298288
```{r}
299-
#| label: deployment-script
289+
#| label: deployment-script-vignette
300290
#| eval: FALSE
301291
library(multideploy)
302292
@@ -334,7 +324,7 @@ If you want to deploy the files directly without creating pull requests, you can
334324
use the following snippet to directly deploy the configuration files:
335325

336326
```{r}
337-
#| label: deployment-script-custom
327+
#| label: deployment-script-custom-vignette
338328
#| eval: FALSE
339329
# Directly deploy config files
340330
for (local_file in names(config_mapping)) {
@@ -352,6 +342,6 @@ for (local_file in names(config_mapping)) {
352342

353343
# Fin
354344

355-
The `multideploy` package streamlines the process of maintaining consistent
345+
The `{multideploy}` package streamlines the process of maintaining consistent
356346
files across multiple GitHub repositories. By automating deployment, you can
357347
ensure standardization while saving significant time and effort.

0 commit comments

Comments
 (0)