-
Notifications
You must be signed in to change notification settings - Fork 6
/
infer_docker_org.R
33 lines (33 loc) Β· 1.06 KB
/
infer_docker_org.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#' Infer Docker registry organisation name
#'
#' Infer Docker registry organisation name from DESCRIPTION file.
#' @inheritParams use_vignette_docker
#' @inheritParams use_workflow
#' @inheritDotParams get_description
#' @returns Docker registry organisation name.
#'
#' @export
#' @examples
#' infer_docker_org(docker_org="myorg", docker_registry="ghcr.io")
infer_docker_org <- function(docker_org=NULL,
docker_registry,
verbose=TRUE,
...){
if(!is.null(docker_org)){
return(docker_org)
} else if(is.null(docker_org) &&
grepl("ghcr.io",docker_registry)){
## Infer docker_org from DESCRIPTION
desc_file <- get_description(verbose = verbose,
...)
gh_url <- get_github_url_desc(desc_file = desc_file[[1]])
if(!is.null(gh_url)){
docker_org <- rev(strsplit(gh_url,"/")[[1]])[2]
return(docker_org)
} else {
stopper("docker_org must be supplied.")
}
} else {
stopper("docker_org must be supplied.")
}
}