Skip to content

Commit 357d4e3

Browse files
bschilderclaude
andcommitted
Add pkgdown site config with echoverse dark theme and improve vignettes
- Create _pkgdown.yml with grouped reference sections and echoverse CSS - Fix VignetteIndexEntry: echoverseTemplate -> devoptera, devoptera -> make_hex - Add has_internet guard for rworkflows::use_badges() call - Add requireNamespace guards for hex sticker Suggests deps - Fix incomplete sentence and typos in devoptera vignette - Fix BiocCheck/devtools references to use BiocStyle helpers - Add doc/ and Meta/ to .gitignore Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 74ee80e commit 357d4e3

4 files changed

Lines changed: 217 additions & 60 deletions

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,6 @@ vignettes/*.R
4242
# R Environment Variables
4343
.Renviron
4444
*.tbi
45-
Rplots.pdf
45+
Rplots.pdf
46+
/doc/
47+
/Meta/

_pkgdown.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
url: https://rajlabmssm.github.io/devoptera/
2+
3+
template:
4+
bootstrap: 5
5+
bslib:
6+
bg: "#1a2744"
7+
fg: "#e8f4f4"
8+
primary: "#4ecdc4"
9+
secondary: "#3a8d8c"
10+
success: "#2ee8d6"
11+
info: "#5bc0be"
12+
code-bg: "#d6e4ee"
13+
code-color: "#1a2744"
14+
border-color: "#2a4060"
15+
link-color: "#4ecdc4"
16+
link-hover-color: "#2ee8d6"
17+
font-size-base: "1rem"
18+
includes:
19+
in_header: |
20+
<style>
21+
.navbar {
22+
background-color: #162038 !important;
23+
border-bottom: 2px solid #4ecdc4;
24+
}
25+
.navbar-brand, .nav-link { color: #e8f4f4 !important; }
26+
.nav-link:hover { color: #2ee8d6 !important; }
27+
.nav-link.active { color: #2ee8d6 !important; border-bottom: 2px solid #2ee8d6; }
28+
pre {
29+
background-color: #d6e4ee !important;
30+
color: #1a2744 !important;
31+
border: none !important;
32+
border-radius: 12px;
33+
margin: 0;
34+
padding: 0.8em 1em;
35+
}
36+
code { color: #1a6b68 !important; border: none !important; }
37+
pre code { color: #1a2744 !important; border: none !important; background: transparent !important; }
38+
pre code span { border: none !important; background: transparent !important; }
39+
.table { color: #e8f4f4 !important; }
40+
.table-striped > tbody > tr:nth-of-type(odd) > * {
41+
background-color: rgba(78, 205, 196, 0.05) !important;
42+
color: #e8f4f4 !important;
43+
}
44+
.table-striped > tbody > tr:nth-of-type(even) > * {
45+
background-color: transparent !important;
46+
color: #e8f4f4 !important;
47+
}
48+
.table > thead { border-bottom: 2px solid #4ecdc4; }
49+
h1, h2, h3, h4, h5, h6 { color: #4ecdc4 !important; }
50+
a { color: #5bc0be; }
51+
a:hover { color: #2ee8d6; }
52+
.card { background-color: #1e3050; border-color: #2a4060; }
53+
.footer { background-color: #162038 !important; border-top: 1px solid #2a4060; }
54+
.page-header { border-bottom: 2px solid #3a8d8c; }
55+
.sourceCode {
56+
background-color: #d6e4ee !important;
57+
border: 1px solid #3a8d8c;
58+
border-radius: 12px !important;
59+
overflow: hidden;
60+
}
61+
.sourceCode code span,
62+
.sourceCode code a {
63+
border: none !important;
64+
outline: none !important;
65+
box-shadow: none !important;
66+
background: transparent !important;
67+
}
68+
</style>
69+
70+
navbar:
71+
structure:
72+
left: [intro, reference, articles, news]
73+
right: [search, github]
74+
components:
75+
github:
76+
icon: fa-github
77+
href: https://github.com/RajLabMSSM/devoptera
78+
79+
articles:
80+
- title: Getting started
81+
contents:
82+
- devoptera
83+
- title: Extras
84+
contents:
85+
- make_hex
86+
- title: Deployment
87+
contents:
88+
- docker
89+
90+
reference:
91+
- title: Development workflow
92+
desc: Tools for accelerating the edit-debug-rebuild cycle
93+
contents:
94+
- source_all
95+
- args2vars
96+
- rma
97+
- restart
98+
- current_file
99+
- list_functions
100+
- stop_early
101+
- title: System utilities
102+
desc: OS detection, permissions, and compiler setup
103+
contents:
104+
- get_os
105+
- set_permissions
106+
- setup_gcc
107+
- title: Package branding
108+
desc: Generate echoverse-themed hex stickers
109+
contents:
110+
- make_hex
111+
- title: Session
112+
desc: Session information and diagnostics
113+
contents:
114+
- session_info

vignettes/devoptera.Rmd

Lines changed: 74 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
2-
title: Get started
2+
title: "Get started"
33
author: '<h4>Authors: <i>`r auths <- eval(parse(text = gsub("person","c",read.dcf("../DESCRIPTION",
44
fields = "Authors@R"))));paste(auths[names(auths)=="given"],auths[names(auths)=="family"],
55
collapse = ", ")`</i></h4>'
66
date: '<h4>Vignette updated: <i>`r format( Sys.Date(), "%b-%d-%Y")`</i></h4>'
77
output: BiocStyle::html_document
88
vignette: |
9-
%\VignetteIndexEntry{echoverseTemplate}
10-
%\usepackage[utf8]{inputenc}
9+
%\VignetteIndexEntry{devoptera}
10+
%\usepackage[utf8]{inputenc}
1111
%\VignetteEngine{knitr::rmarkdown}
1212
---
1313

@@ -23,14 +23,18 @@ library(`r pkg`)
2323

2424
# Development workflow
2525

26-
Here, we show how `devoptera` can be used to greatly accelerate your R package development workflow.
26+
Here, we show how `devoptera` can be used to greatly accelerate your
27+
R package development workflow.
2728

2829
## `source_all`
2930

30-
Let's say you have many functions in your *R* folder and want to have access to them all without having to write out the `pkg:::internal_func` notation. You can source all the functions at once by running `devoptera::source_all`.
31+
Let's say you have many functions in your *R* folder and want to have
32+
access to them all without having to write out the `pkg:::internal_func`
33+
notation. You can source all the functions at once by running
34+
`devoptera::source_all`.
3135

32-
Thus function can also load any R packages you need by supplying the
33-
package names to the
36+
This function can also load any R packages you need by supplying the
37+
package names to the `packages` argument.
3438

3539
```{r}
3640
devoptera::source_all(packages = c("rlang","data.table"))
@@ -39,18 +43,34 @@ devoptera::source_all(packages = c("rlang","data.table"))
3943

4044
## `args2vars`
4145

42-
As a developer, how often do you find yourself realizing there's a bug somewhere inside your function. You could:
43-
44-
* **`Strategy 2`: Edit --> Rebuild --> Repeat**: Make a change to the code, rebuild the package, and rerun the function as a whole. This most closely mimics how it will run in production, but is extremely slow when iterating this edit-rebuild process many, many times over.
45-
* **`Strategy 2`:Run internal code line-by-line**: Alternatively, you could go within your function, run one line of code at a time and inspect the variables it produces at each step. This is much faster than guessing whether your changes fixed the bug and rebuilding each time to find out whether they worked. But in order to do this, you first need to initialise each argument in your function as a global variable so that you can run the code line-by-line. But your function has many arguments, so now you spend the next minute(s) tediously making each argument into a variable of the same name (using the defaults as the assigned values).
46-
47-
`devoptera::args2vars` automates `Strategy 2` by first running `source_all` (from previous example) and then automatically assigning each of your function's arguments as global variables in your R environment.
48-
Voila! No more tedious argument defining, allowing you to rapidly debug your code before going to rebuild the entire package.
49-
50-
### Define a function
46+
As a developer, how often do you find yourself realizing there's a bug
47+
somewhere inside your function? You could:
48+
49+
* **Strategy 1: Edit --> Rebuild --> Repeat**: Make a change to the code,
50+
rebuild the package, and rerun the function as a whole. This most closely
51+
mimics how it will run in production, but is extremely slow when iterating
52+
this edit-rebuild process many, many times over.
53+
* **Strategy 2: Run internal code line-by-line**: Alternatively, you could
54+
go within your function, run one line of code at a time and inspect the
55+
variables it produces at each step. This is much faster than guessing
56+
whether your changes fixed the bug and rebuilding each time to find out
57+
whether they worked. But in order to do this, you first need to initialise
58+
each argument in your function as a global variable so that you can run the
59+
code line-by-line. But your function has many arguments, so now you spend
60+
the next minute(s) tediously making each argument into a variable of the
61+
same name (using the defaults as the assigned values).
62+
63+
`devoptera::args2vars` automates **Strategy 2** by first running
64+
`source_all` (from previous example) and then automatically assigning each
65+
of your function's arguments as global variables in your R environment.
66+
No more tedious argument defining, allowing you to rapidly debug your code
67+
before going to rebuild the entire package.
68+
69+
### Define a function
5170

5271
Here we define an arbitrary function with 3 arguments.
53-
If your function is already in one of your source files (i.e. a *.R* file within the *R/* subfolder), you can skip this step.
72+
If your function is already in one of your source files (i.e. a *.R* file
73+
within the *R/* subfolder), you can skip this step.
5474

5575
```{r}
5676
myfunc <- function(a=1, b=2, c=a+b){
@@ -60,7 +80,8 @@ myfunc <- function(a=1, b=2, c=a+b){
6080

6181
### Convert arguments to variables
6282

63-
Now we will convert all the default arguments of `myfunc` to global variables. It also returns a named list with each variable's assigned value.
83+
Now we will convert all the default arguments of `myfunc` to global
84+
variables. It also returns a named list with each variable's assigned value.
6485

6586
```{r}
6687
args <- devoptera::args2vars(myfunc)
@@ -72,75 +93,88 @@ After debugging your code, you can now proceed to the next steps.
7293

7394
### Clear
7495

75-
Remove all variables using `devoptera::rma()`,
76-
or by clicking the little broom :broom: in the upper right of your `Environment` panel in RStudio.
96+
Remove all variables using `devoptera::rma()`,
97+
or by clicking the little broom in the upper right of your `Environment`
98+
panel in RStudio.
7799

78-
This is important as it will ensure that the names of functions/variables in your global environment (created with `source_all`/`args2vars`) don't override the functions/variables within your reinstalled package (in the next step).
100+
This is important as it will ensure that the names of functions/variables in
101+
your global environment (created with `source_all`/`args2vars`) don't
102+
override the functions/variables within your reinstalled package
103+
(in the next step).
79104

80105
```{r}
81106
devoptera::rma()
82107
```
83108

84109
### Reinstall
85110

86-
(Re)install your package with `devoptera::install` (imported directly from `devtools::install`),
111+
(Re)install your package with `devtools::install()`,
87112
or by clicking the `Install` button within the `Build` panel in RStudio.
88113

89-
This function is equivalent to the keystrokes `CMD`+`SHIFT`+`B` within RStudio.
114+
This is equivalent to the keystrokes `CMD`+`SHIFT`+`B` within RStudio.
90115

91116
```{r, eval=FALSE}
92-
install()
117+
devtools::install()
93118
```
94119

95120
### Check
96121

97-
Now you can recheck your package as usual to make sure everything runs as expected.
122+
Now you can recheck your package as usual to make sure everything runs
123+
as expected.
98124

99125
#### [CRAN](https://cran.r-project.org/) checks
100126

101-
This `check` function is directly imported from `r `BiocStyle::CRANpkg('devtools')`.
127+
The `check` function from `r BiocStyle::CRANpkg('devtools')` runs
128+
`R CMD check` on your package.
102129

103-
This function is equivalent to the keystrokes `CMD`+`SHIFT`+`E` within RStudio.
130+
This is equivalent to the keystrokes `CMD`+`SHIFT`+`E` within RStudio.
104131

105132
```{r, eval=FALSE}
106-
check()
133+
devtools::check()
107134
```
108135

109136
#### [Bioconductor](https://bioconductor.org/) checks
110137

111-
This `BiocCheck` function is directly imported from `r `Biocpkg::CRANpkg('BiocCheck')`.
138+
The `BiocCheck` function from `r BiocStyle::Biocpkg('BiocCheck')` runs
139+
additional Bioconductor-specific checks.
112140

113141
```{r, eval=FALSE}
114-
BiocCheck()
142+
BiocCheck::BiocCheck()
115143
```
116144

117145

118-
If you still run into some bugs or unexpected behaviour, don't worry!
119-
You can still easily go back and repeat this process until everything is working smoothly.
146+
If you still run into some bugs or unexpected behaviour, don't worry!
147+
You can still easily go back and repeat this process until everything
148+
is working smoothly.
120149

121150
# Extra functions
122151

123152
## Restarting R
124153

125-
Restarting your R session can be helpful or necessary in a variety of situations. Not only does it clear your variables, it unloads all packages which is necessary when you want to use a package you just installed a new version of.
154+
Restarting your R session can be helpful or necessary in a variety of
155+
situations. Not only does it clear your variables, it unloads all packages
156+
which is necessary when you want to use a package you just installed
157+
a new version of.
126158

127-
This function is equivalent to the keystrokes `CMD`+`SHIFT`+`0` within RStudio.
159+
This is equivalent to the keystrokes `CMD`+`SHIFT`+`0` within RStudio.
128160

129161
```{r, eval=FALSE}
130162
devoptera::restart()
131163
```
132164

133-
134165

135-
# Session Info
166+
# Session Info
136167

137-
It is best practice to always include your R Session Info in any Rmarkdown report or vignette. It contains information about which OS, R version, and R package versions you generated the report with.
168+
It is best practice to always include your R Session Info in any
169+
Rmarkdown report or vignette. It contains information about which OS,
170+
R version, and R package versions you generated the report with.
138171

139-
`devoptera::session_info` provides a collapsible version of the Session Info, which can be helpful when Session Info is particularly long.
172+
`devoptera::session_info` provides a collapsible version of the Session
173+
Info, which can be helpful when Session Info is particularly long.
140174

141-
<details>
175+
<details>
142176
```{r Session Info}
143177
devoptera::session_info()
144178
```
145-
</details>
179+
</details>
146180
<hr>

0 commit comments

Comments
 (0)