Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
- Change lapply to for
- Change port in test from 9999 to random
- Change example from dontrun to interactive()
  • Loading branch information
ElianHugh committed Jun 24, 2024
1 parent 6b3f4b0 commit 66a7e48
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 19 deletions.
2 changes: 1 addition & 1 deletion R/config.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ new_config <- function(...) {
host = host
),
ignore = ignore,
runner_compute = "hotwater_runner" # todo fix
runner_compute = "hotwater_runner"
),
class = c("hotwater_config", "list")
)
Expand Down
2 changes: 1 addition & 1 deletion R/run.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#' @param ignore vector of files or file extensions to ignore (globs)
#'
#' @examples
#' \dontrun{
#' if (interactive()) {
#' hotwater::run(system.file("examples", "plumber.R", package = "hotwater"))
#' }
#'
Expand Down
26 changes: 11 additions & 15 deletions R/script.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ common_install_paths <- list(
"/usr/local/bin/",
"/bin/"
),
windows = c()
windows = c() # does windows even work with this?
)

#' WORK IN PROGRESS
Expand Down Expand Up @@ -55,21 +55,17 @@ uninstall_hotwater <- function(install_folder = "~/.local/bin/") {
#' @noRd
check_suggests <- function() {
suggests <- c("docopt")
lapply(
suggests,
function(suggestion) {
if (!requireNamespace(suggestion, quietly = TRUE)) {
cli::cli_abort(
c(
"Running {.pkg hotwater} from the command-line requires the {.pkg {suggestion}} package",
"*" = "Try running {.code install.packages('{suggestion}')}"
),
call = globalenv()
)
}
for (suggestion in suggests) {
if (!requireNamespace(suggestion, quietly = TRUE)) {
cli::cli_abort(
c(
"Running {.pkg hotwater} from the command-line requires the {.pkg {suggestion}} package",
"*" = "Try running {.code install.packages('{suggestion}')}"
),
call = globalenv()
)
}
)
invisible()
}
}

#' Run hotwater as a bash script
Expand Down
2 changes: 1 addition & 1 deletion man/run.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion tests/testthat/test-engine.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
test_that("engine reuse", {
engine <- new_engine(
new_config(
port = 9999L,
path = "./foo/bar.R",
dirs = "./R",
host = "127.0.0.1"
Expand Down

0 comments on commit 66a7e48

Please sign in to comment.