lkb-pipeline/boot.R
allaun e5bfdc0492 feat: LKB compute pipeline + eigensolid receipts
Containerized LKB worker (Dockerfile.lkb), Postgres-backed queue,
auto-deploy timer, and eigensolid convergence check module.

Build: 0 jobs (no Lean build needed)
2026-07-08 20:01:29 -05:00

47 lines
No EOL
1.4 KiB
R

box_use <- function(...) {
args <- as.list(sys.call())[-1]
caller <- parent.frame()
for (arg in args) {
arg_str <- deparse(arg)
arg_str <- gsub('^"|"$', '', arg_str)
arg_str <- gsub("^'|'$", '', arg_str)
if (startsWith(arg_str, "./") || startsWith(arg_str, "../")) {
path <- sub("^\\.\\./", "", arg_str)
path <- sub("^\\./", "", path)
env <- new.env(parent = caller)
candidates <- c(
paste0(path, ".R"),
paste0("core/", basename(path), ".R"),
paste0("../", path, ".R")
)
found <- FALSE
for (f in candidates) {
if (file.exists(f)) {
sys.source(f, envir = env)
found <- TRUE
break
}
}
if (!found) stop("Module not found: ", arg_str)
assign(basename(path), env, envir = caller)
} else if (grepl("\\[", arg_str)) {
pkgs <- strsplit(arg_str, "\\],\\s*|,\\s*(?=[a-zA-Z])")[[1]]
for (pkg_spec in pkgs) {
pkg_spec <- trimws(pkg_spec)
pkg_name <- sub("\\[.*", "", pkg_spec)
library(pkg_name, character.only = TRUE)
if (grepl("\\[", pkg_spec)) {
exports <- trimws(strsplit(sub(".*\\[(.*)\\]", "\\1", pkg_spec), ",")[[1]])
for (ex in exports) {
assign(ex, get(ex, envir = asNamespace(pkg_name)), envir = caller)
}
}
}
} else {
library(arg_str, character.only = TRUE)
}
}
invisible(NULL)
}