forked from FredHutch/shiny-cromwell
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
31 lines (26 loc) · 1.59 KB
/
Makefile
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
RSCRIPT = Rscript --no-init-file
FILE_TARGET := "${FILE}"
DEPS := $(shell ${RSCRIPT} -e 'invisible(lapply(c("glue", "cli"), require, character.only = TRUE, quiet = TRUE))' -e 'deps = renv::dependencies(quiet = TRUE)' -e 'uniq_pkgs = sort(unique(deps$$Package))' -e 'uniq_pkgs = uniq_pkgs[!grepl("^proofr$$|^rcromwell$$", uniq_pkgs)]' -e 'cat(c("getwilds/[email protected]", "getwilds/[email protected]", uniq_pkgs), file="deps.txt", sep="\n")')
run:
${RSCRIPT} -e "options(shiny.autoreload = TRUE)" \
-e "shiny::runApp(\"app\", launch.browser = TRUE)"
run_docker:
docker build --platform linux/amd64 -t shiny-cromwell:app .
docker run --rm -it -p 3838:3838 shiny-cromwell:app
# use: `make style_file FILE=stuff.R`
# accepts 1 file only
style_file:
${RSCRIPT} -e 'styler::style_file(${FILE_TARGET})'
pkg_deps_cmd:
@${RSCRIPT} -e 'invisible(lapply(c("glue", "cli"), require, character.only = TRUE, quiet = TRUE))' \
-e 'uniq_pkgs = readLines("deps.txt")' \
-e 'cli_alert_info("Found {length(uniq_pkgs)} packages")' \
-e 'cli_alert_info("Here are the installation instructions:")' \
-e "cli_code(glue('pak::pak(c({glue_collapse(double_quote(uniq_pkgs), sep = \", \")}))'))"
pkg_deps_install:
@${RSCRIPT} -e 'invisible(lapply(c("glue", "cli"), require, character.only = TRUE, quiet = TRUE))' \
-e 'uniq_pkgs = readLines("deps.txt")' \
-e 'cli_alert_info("Found {length(uniq_pkgs)} packages")' \
-e 'cli_alert_info(glue("{glue_collapse(uniq_pkgs, sep = \", \")}"))' \
-e 'cli_alert_info("Installing them using pak:")' \
-e "pak::pak(eval(parse(text = glue('c({glue_collapse(double_quote(uniq_pkgs), sep = \", \")})'))))"