-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add function to return details of report script from parsed exprs #129
Changes from 4 commits
1a64802
3569e87
a2c43de
0665401
ee5d7e6
ded36b3
321b63e
e435441
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: orderly2 | ||
Title: Orderly Next Generation | ||
Version: 1.99.12 | ||
Version: 1.99.13 | ||
Authors@R: c(person("Rich", "FitzJohn", role = c("aut", "cre"), | ||
email = "[email protected]"), | ||
person("Robert", "Ashton", role = "aut"), | ||
|
@@ -11,7 +11,7 @@ Description: Reimplementation of orderly based on outpack. | |
License: MIT + file LICENSE | ||
Encoding: UTF-8 | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 7.2.3 | ||
RoxygenNote: 7.3.1 | ||
URL: https://github.com/mrc-ide/orderly2 | ||
BugReports: https://github.com/mrc-ide/orderly2/issues | ||
Imports: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,30 @@ | ||
orderly_read <- function(path, call = NULL) { | ||
entrypoint_filename <- find_entrypoint_filename(path) | ||
orderly_read_r(file.path(path, entrypoint_filename), entrypoint_filename) | ||
orderly_parse(file.path(path, entrypoint_filename), entrypoint_filename) | ||
} | ||
|
||
|
||
orderly_read_r <- function(path, entrypoint_filename) { | ||
exprs <- parse(file = path) | ||
#' Parse the orderly entrypoint script | ||
#' | ||
#' For expert use only. | ||
#' | ||
#' Takes either a path to the orderly entrypoint script or | ||
#' the parsed AST from an orderly script, parses details | ||
#' of any calls to the orderly_ in-script functions into intermediate | ||
#' representation for downstream use. Also validates that any calls to | ||
#' orderly_ in-script functions are well-formed. | ||
#' | ||
#' @param entrypoint_script Path to script or parsed AST from orderly script | ||
#' @param entrypoint_filename Name of entrypoint file to include in metadata | ||
#' | ||
#' @return Parsed orderly entrypoint script | ||
#' @export | ||
orderly_parse <- function(entrypoint_script, entrypoint_filename) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sold on these argument names (sorry). How about accepting You should also check that exactly one of these is given; this is quite annoying to do; you can use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Initially put this in but felt kind of gross when chatting through it with Mantra, I've split this into 2 functions now. How does that look? |
||
if (!is.expression(entrypoint_script)) { | ||
exprs <- parse(file = entrypoint_script) | ||
} else { | ||
exprs <- entrypoint_script | ||
} | ||
|
||
inputs <- list() | ||
artefacts <- list() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,3 +86,4 @@ reference: | |
- orderly_validate_archive | ||
- orderly_hash_data | ||
- orderly_hash_file | ||
- orderly_parse |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.