Skip to content

Commit 5cef94e

Browse files
committed
fix use_vignette_ funcs
1 parent de8b476 commit 5cef94e

19 files changed

+555
-778
lines changed

.Rhistory

Lines changed: 404 additions & 404 deletions
Large diffs are not rendered by default.

.github/workflows/rworkflows.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ jobs:
3131
r: latest
3232
bioc: release
3333
steps:
34-
- if: ${{ env.ACT }}
35-
name: Hack container for local development
36-
run: |
37-
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
38-
sudo apt-get install -y nodejs
39-
shell: bash {0}
4034
- uses: neurogenomics/rworkflows@master
4135
with:
4236
run_bioccheck: ${{ false }}
@@ -53,4 +47,4 @@ jobs:
5347
docker_org: neurogenomicslab
5448
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
5549
runner_os: ${{ runner.os }}
56-
cache_version: cache-v1
50+
cache_version: cache-master

DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ Suggests:
3737
BiocStyle,
3838
covr,
3939
testthat (>= 3.0.0),
40-
hexSticker
40+
hexSticker,
41+
htmltools
4142
RoxygenNote: 7.2.2
4243
VignetteBuilder: knitr
4344
License: GPL-3

NEWS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
## Bug fixes
1313

14-
- Make `badger` a *Import*
14+
* Make `badger` a *Import*
15+
* Use Dockerfile stored in *inst/templates* instead of getting from GitHub.
1516

1617
# rworkflows 0.99.1
1718

R/fill_yaml.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ fill_yaml <- function(yml,
5959
yml$env <- with2
6060
} else if(name=="rworkflows"){
6161
#### replace with: args ####
62-
yml$jobs[[1]]$steps[[2]]$with <- with2
62+
steps <- yml$jobs[[1]]$steps
63+
steps[[length(steps)]]$with <- with2
6364
}
6465
return(yml)
6566
}

R/get_hex.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get_hex <- function(branch,
44
add_html=TRUE,
55
verbose=TRUE){
66

7-
if("URL" %in% desc:::desc_fields()){
7+
if("URL" %in% desc::desc_fields()){
88
URL <- desc::desc_get_field(key = "URL")
99
} else {
1010
wrn <- "URL key not found in DESCRIPTION file."

R/get_yaml.R

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,25 @@ get_yaml <- function(name){
33
workflow_nms <- c("rworkflows","rworkflows_static")
44
handlers <- list('bool#yes' = function(x) { if (x == "on") x else TRUE})
55
#### Check name and read in #####
6+
#### Dynamic action ####
67
if(is.null(name) ||
78
name=="rworkflows"){
89
yml <- yaml::read_yaml(
910
system.file("templates","rworkflows_template.yml",
1011
package = "rworkflows"),
1112
handlers = handlers)
13+
#### Static workflow ####
1214
} else if(name=="rworkflows_static"){
1315
yml <- yaml::read_yaml(
1416
system.file("templates","rworkflows_template_static.yml",
1517
package = "rworkflows"),
16-
handlers = handlers)
18+
handlers = handlers)
19+
#### Read in action to avoid code redundancy ####
20+
## Import the latest version of action.yml
21+
action <- yaml::read_yaml(
22+
"https://github.com/neurogenomics/rworkflows/raw/master/action.yml")
23+
#### Add action steps to static workflow ####
24+
yml$jobs$rworkflows_static$steps <- action$runs$steps
1725
} else {
1826
stp <- paste("`name` must be one of:",
1927
paste("\n -",shQuote(workflow_nms),collapse = ""))

R/set_vignette_index.R

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
set_vignette_index <- function(yml,
2+
pattern="%\\VignetteIndexEntry{docker}",
3+
vignette_index_entry){
4+
yml$vignette <- gsub(
5+
"} ","}\n",
6+
gsub(
7+
pattern,
8+
paste0("%\\VignetteIndexEntry{",vignette_index_entry,"}"),
9+
yml$vignette,
10+
fixed = TRUE),
11+
fixed=TRUE
12+
)
13+
return(yml)
14+
}

R/use_dockerfile.R

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@ use_dockerfile <- function(save_dir=getwd(),
2020
show=FALSE,
2121
verbose=TRUE){
2222

23-
if(file.exists(path) & isFALSE(force_new)){
23+
if(file.exists(path) &&
24+
isFALSE(force_new)){
2425
messager("Using existing Docker file:",path,v=verbose)
2526
} else {
2627
messager("Creating new Docker file ==>",path,v=verbose)
27-
dir.create(dirname(path), showWarnings = FALSE, recursive = TRUE)
28-
utils::download.file(
29-
url = "https://github.com/neurogenomics/rworkflows/raw/master/Dockerfile",
30-
destfile = path)
28+
dir.create(dirname(path), showWarnings = FALSE, recursive = TRUE)
29+
file.copy(from = system.file("templates","Dockerfile",
30+
package = "rworkflows"),
31+
to = path,
32+
overwrite = TRUE)
3133
}
3234
if(isTRUE(show)){
3335
messager("Docker file preview:",v=verbose)

R/use_vignette_docker.R

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,9 @@ use_vignette_docker <- function(docker_org,
5454
yml$params$docker_org$value <- docker_org
5555
## vignette title
5656
yml$title <- title
57-
yml$vignette <- gsub(
58-
"%\\VignetteIndexEntry{docker}",
59-
paste0("%\\VignetteIndexEntry{",vignette_index_entry,"}"),
60-
yml$vignette,
61-
fixed = TRUE)
57+
yml <- set_vignette_index(yml = yml,
58+
pattern = "%\\VignetteIndexEntry{docker}",
59+
vignette_index_entry = vignette_index_entry)
6260
#### Render to text ####
6361
yml_txt <- gsub("''","\"",yaml::as.yaml(yml))
6462
new_rmd <-c("---",strsplit(yml_txt,"\n")[[1]],"---",

0 commit comments

Comments
 (0)