Skip to content

Commit a204f03

Browse files
committed
Add -autolink_bare_uris to use_vignette_docker
1 parent 293c8e7 commit a204f03

File tree

10 files changed

+85
-51
lines changed

10 files changed

+85
-51
lines changed

NEWS.md

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,16 @@
44

55
* Synchronise `rworkflows` package versioning with `rworkflows` action
66
Release versioning.
7+
* `use_vignette_docker`/`use_vignette_getstarted`
8+
- Autofill `package` arg if not provided.
9+
10+
## Bug fixes
711

8-
# rworkflows 0.99.15
9-
10-
## New features
11-
12-
* Add *.devcontainer/devcontainer.json*
13-
* `use_vignette_docker`
14-
- New helper func: `infer_docker_org`
15-
16-
## Bug fixes
12+
* *inst/template/docker.Rmd*
13+
- Remove the need to include `construct_cont`,
14+
as not everyone will have `rworkfows` installed on the machine where
15+
the vignette is being rendered.
1716

18-
* `infer_deps`
19-
- Pass `infer_deps` the *DESCRIPTION* path directly
20-
within the `fill_description` func.
21-
- Fix unit tests.
22-
* `conda_*`
23-
- Try to get reticularte to find the path to conda
24-
installed by `setup-miniconda`.
25-
* New func: `use_codespace`
26-
- Create dev container config file.
27-
* *.Rprofile*
28-
- Added to avoid CRAN issues with bioc packages.
29-
3017
# rworkflows 0.99.14
3118

3219
## New features
@@ -68,6 +55,9 @@ Release versioning.
6855
* `use_workflow`
6956
- `template` arg can now be "rworkflows_static:dev" to use the "dev" branch's
7057
version of *action.yml* as a workflow template.
58+
* Add *.devcontainer/devcontainer.json*
59+
* `use_vignette_docker`
60+
- New helper func: `infer_docker_org`
7161

7262
## Bug fixes
7363

@@ -81,6 +71,19 @@ Release versioning.
8171
* *action.yml*
8272
- Remove unnecessary export:`echo "GITHUB_TOKEN=${{ inputs.GITHUB_TOKEN }}" >> $GITHUB_ENV`
8373
- Fix `runforesight/workflow-telemetry-action` step and move to top.
74+
* `infer_deps`
75+
- Pass `infer_deps` the *DESCRIPTION* path directly
76+
within the `fill_description` func.
77+
- Fix unit tests.
78+
* `conda_*`
79+
- Try to get reticularte to find the path to conda
80+
installed by `setup-miniconda`.
81+
* New func: `use_codespace`
82+
- Create dev container config file.
83+
* *.Rprofile*
84+
- Added to avoid CRAN issues with bioc packages.
85+
86+
8487

8588
# rworkflows 0.99.13
8689

R/use_vignette_docker.R

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#' Creates a vignette rmarkdown file demonstrates how to create a
44
#' Docker/Singularity image from a container stored in
55
#' \href{https://hub.docker.com/}{Dockerhub}.
6+
#' @param package R package name.
67
#' @param docker_org Docker registry organization name.
78
#' Can simply be your registry username instead.
89
#' If \code{NULL}, \code{docker_org} will be inferred as the R package's GitHub
@@ -27,42 +28,54 @@
2728
#' @param output Vignette output style.
2829
#' Defaults to \link[BiocStyle]{html_document}.
2930
#' @inheritParams use_workflow
31+
#' @inheritParams construct_runners
3032
#' @returns Path to vignette file.
3133
#'
3234
#' @export
3335
#' @importFrom yaml read_yaml as.yaml
3436
#' @importFrom here here
3537
#' @examples
36-
#' path <- use_vignette_docker(docker_org = "neurogenomics",
38+
#' path <- use_vignette_docker(package = "mypackage",
39+
#' docker_org = "neurogenomics",
3740
#' ## use default save_dir in practice
3841
#' save_dir = tempdir())
39-
use_vignette_docker <- function(docker_org = NULL,
42+
use_vignette_docker <- function(package = names(get_description()),
43+
docker_org = NULL,
4044
docker_registry="ghcr.io",
45+
cont = construct_cont(
46+
cont = paste(docker_org,
47+
package,
48+
sep="/"),
49+
default_registry =docker_registry)[[1]],
4150
title="Docker/Singularity Containers",
4251
vignette_index_entry="docker",
4352
save_dir=here::here(),
4453
path=file.path(save_dir,
4554
"vignettes",
4655
"docker.Rmd"),
47-
output="BiocStyle::html_document",
56+
output=list(
57+
"BiocStyle::html_document"= list(
58+
"md_extensions"="-autolink_bare_uris"
59+
)
60+
),
4861
port_in=8787,
4962
port_out=8900,
5063
force_new=FALSE,
5164
show=FALSE,
5265
verbose=TRUE){
5366
# devoptera::args2vars(use_vignette_docker, reassign = TRUE)
54-
55-
force(docker_org)
56-
#### Infer docker_org
57-
docker_org <- infer_docker_org(docker_org=docker_org,
58-
docker_registry=docker_registry,
59-
verbose=verbose)
67+
6068
#### Check if file exists already ####
6169
if(file.exists(path) &
6270
isFALSE(force_new)){
6371
messager("Using existing vignette file:",path,v=verbose)
6472
} else {
6573
messager("Creating new vignette file ==>",path,v=verbose)
74+
force(docker_org)
75+
#### Infer docker_org
76+
docker_org <- infer_docker_org(docker_org=docker_org,
77+
docker_registry=docker_registry,
78+
verbose=verbose)
6679
dir.create(dirname(path), showWarnings = FALSE, recursive = TRUE)
6780
#### get the template ####
6881
template_path <- system.file("templates","docker.Rmd",
@@ -73,6 +86,8 @@ use_vignette_docker <- function(docker_org = NULL,
7386
rev(grep("---",l))[1] )
7487
yml <- yaml::read_yaml(text = l[yml_lines])
7588
#### Set params ####
89+
## cont
90+
yml$params$cont$value <- cont
7691
## docker_registry
7792
yml$params$docker_registry$value <- docker_registry
7893
## docker_org

R/use_vignette_getstarted.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#' path <- use_vignette_getstarted(package = "mypackage",
1313
#' ## use default save_dir in practice
1414
#' save_dir = tempdir())
15-
use_vignette_getstarted <- function(package,
15+
use_vignette_getstarted <- function(package = names(get_description()),
1616
title="Get started",
1717
vignette_index_entry=package,
1818
save_dir=here::here(),

README.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: ""
3-
author: "`r rworkflows::use_badges(add_actions=c('rworkflows','rworkflows_static','rworkflows_dev'), add_cran_release = TRUE, add_cran_checks = TRUE, add_cran_download_month=TRUE, add_cran_download_total=TRUE, add_codecov_graphs='icicle', hex_height=350, add_doi='https://doi.org/10.21203/rs.3.rs-2399015/v1')`"
3+
author: "`r rworkflows::use_badges(add_actions=c('rworkflows','rworkflows_static','rworkflows_dev'), add_cran_release = TRUE, add_cran_checks = TRUE, add_cran_download_month=TRUE, add_cran_download_total=TRUE, add_codecov_graphs='icicle', hex_height=350, add_doi='https://doi.org/10.5281/zenodo.10048573')`"
44
date: "<h4>README updated: <i>`r format( Sys.Date(), '%b-%d-%Y')`</i></h4>"
55
output:
66
github_document

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ checks](https://badges.cranchecks.info/summary/rworkflows.svg)](https://cran.r-p
66
[![](http://cranlogs.r-pkg.org/badges/grand-total/rworkflows?color=black)](https://cran.r-project.org/package=rworkflows)
77
[![License:
88
GPL-3](https://img.shields.io/badge/license-GPL--3-blue.svg)](https://cran.r-project.org/web/licenses/GPL-3)
9-
[![](https://img.shields.io/badge/doi-https://doi.org/10.21203/rs.3.rs--2399015/v1-blue.svg)](https://doi.org/https://doi.org/10.21203/rs.3.rs-2399015/v1)
9+
[![](https://img.shields.io/badge/doi-https://doi.org/10.5281/zenodo.10048573-blue.svg)](https://doi.org/https://doi.org/10.5281/zenodo.10048573)
1010
<br>
11-
[![](https://img.shields.io/badge/devel%20version-0.99.14-black.svg)](https://github.com/neurogenomics/rworkflows)
11+
[![](https://img.shields.io/badge/devel%20version-1.0.0-black.svg)](https://github.com/neurogenomics/rworkflows)
1212
[![](https://img.shields.io/github/languages/code-size/neurogenomics/rworkflows.svg)](https://github.com/neurogenomics/rworkflows)
1313
[![](https://img.shields.io/github/last-commit/neurogenomics/rworkflows.svg)](https://github.com/neurogenomics/rworkflows/commits/master)
1414
<br> [![R build
@@ -24,7 +24,7 @@ status](https://github.com/neurogenomics/rworkflows/workflows/rworkflows_dev/bad
2424
Authors: <i>Brian Schilder, Alan Murphy, Nathan Skene</i>
2525
</h4>
2626
<h4>
27-
README updated: <i>Oct-28-2023</i>
27+
README updated: <i>Nov-01-2023</i>
2828
</h4>
2929

3030
## Intro
@@ -84,7 +84,7 @@ options to enable/disable/modify each step):
8484
[**DockerHub**](https://hub.docker.com/)).
8585
11. 🔭 Generates [workflow
8686
telemetry](https://github.com/runforesight/workflow-telemetry-action)
87-
report.
87+
report.
8888
12. 🎖 Updates relevant badges added to your README with
8989
`rworkflows::use_badges()`.
9090

@@ -317,7 +317,7 @@ utils::sessionInfo()
317317
## [25] rlang_1.1.1 utf8_1.2.4 cachem_1.0.8
318318
## [28] badger_0.2.3 xfun_0.40 fs_1.6.3
319319
## [31] memoise_2.0.1.9000 cli_3.6.1 magrittr_2.0.3
320-
## [34] rworkflows_0.99.14 digest_0.6.33 grid_4.3.1
320+
## [34] rworkflows_1.0.0 digest_0.6.33 grid_4.3.1
321321
## [37] rstudioapi_0.15.0 lifecycle_1.0.3 vctrs_0.6.4
322322
## [40] data.table_1.14.8 evaluate_0.22 glue_1.6.2
323323
## [43] fansi_1.0.5 colorspace_2.1-0 rmarkdown_2.25

inst/templates/docker.Rmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ output:
88
"-autolink_bare_uris"
99
]
1010
params:
11+
cont:
12+
value: NULL
1113
docker_registry:
1214
value: "ghcr.io"
1315
docker_org:
@@ -28,10 +30,8 @@ library(PKG, character.only = TRUE)
2830
pkg <- tolower(PKG)
2931
#### Username of DockerHub account ####
3032
docker_org <- params$docker_org
31-
docker_registry <- params$docker_registry
32-
33-
cont <- construct_cont(cont = paste(docker_org,pkg,sep="/"),
34-
default_registry =docker_registry)[[1]]
33+
docker_registry <- params$docker_registry
34+
cont <- params$cont
3535
docker_url <- if(grepl("ghcr.io",docker_registry)){
3636
paste("https://ghcr.io",cont,sep="/")
3737
} else {

man/use_vignette_docker.Rd

Lines changed: 14 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/use_vignette_getstarted.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-use_vignette_docker.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
test_that("use_vignette_docker works", {
22

3-
path <- use_vignette_docker(docker_org = "neurogenomicslab",
3+
path <- use_vignette_docker(package = "mypackage",
4+
docker_org = "neurogenomicslab",
45
save_dir = tempdir())
56
testthat::expect_true(file.exists(path))
67

78
out <- testthat::capture_output_lines({
8-
path2 <- use_vignette_docker(docker_org = "neurogenomicslab",
9+
path2 <- use_vignette_docker(package = "mypackage",
10+
docker_org = "neurogenomicslab",
911
save_dir = tempdir(),
1012
show = TRUE)
1113
})

vignettes/docker.Rmd

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ author: '<h4>Authors: <i>`r auths <- eval(parse(text = gsub("person","c",read.dc
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>'
7-
output: BiocStyle::html_document
7+
output:
8+
BiocStyle::html_document:
9+
md_extensions: -autolink_bare_uris
810
params:
11+
cont:
12+
value: ghcr.io/neurogenomics/rworkflows
913
docker_registry:
1014
value: ghcr.io
1115
docker_org:
@@ -25,10 +29,8 @@ library(PKG, character.only = TRUE)
2529
pkg <- tolower(PKG)
2630
#### Username of DockerHub account ####
2731
docker_org <- params$docker_org
28-
docker_registry <- params$docker_registry
29-
30-
cont <- construct_cont(cont = paste(docker_org,pkg,sep="/"),
31-
default_registry =docker_registry)[[1]]
32+
docker_registry <- params$docker_registry
33+
cont <- params$cont
3234
docker_url <- if(grepl("ghcr.io",docker_registry)){
3335
paste("https://ghcr.io",cont,sep="/")
3436
} else {

0 commit comments

Comments
 (0)