Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
- Remove remotes and xml2 from suggests (not needed)
- WIP docs
- Fix usage linter
  • Loading branch information
ElianHugh committed Jun 25, 2024
1 parent 4f00107 commit 4bf0b6d
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .lintr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ linters: linters_with_defaults(
implicit_integer_linter(),
indentation_linter(indent = 4L),
object_name_linter(styles = c("snake_case", "symbols"), regexes = character()),
object_name_linter = NULL
object_usage_linter = NULL
)
exclusions: list("man/", "inst/", "src/", ".vscode/", ".Rproj.user/", "R/import-standalone-obj-type.R", "R/import-standalone-types-check.R")
encoding: "UTF-8"
2 changes: 0 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ Imports:
Suggests:
box,
docopt,
remotes,
testthat (>= 3.0.0),
xml2,
withr
Config/testthat/edition: 3
Encoding: UTF-8
Expand Down
17 changes: 14 additions & 3 deletions R/script.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ common_install_paths <- list(
windows = c() # does windows even work with this?
)

#' WORK IN PROGRESS
#' Install global hotwater script
#'
#' @param install_folder folder (in PATH) to install hotwater
#' @examples
#' if (interactive()) {
#' hotwater::install_hotwater()
#' }
#'
#' @export
install_hotwater <- function(install_folder = "~/.local/bin/") {
p <- file.path(install_folder, "hotwater")
Expand All @@ -31,8 +37,13 @@ install_hotwater <- function(install_folder = "~/.local/bin/") {
}
}

#' WORK IN PROGRESS
#' Uninstall global hotwater script
#'
#' @param install_folder folder (in PATH) to uninstall hotwater
#' @examples
#' if (interactive()) {
#' hotwater::uninstall_hotwater()
#' }
#' @export
uninstall_hotwater <- function(install_folder = "~/.local/bin/") {
p <- file.path(install_folder, "hotwater")
Expand All @@ -50,7 +61,7 @@ uninstall_hotwater <- function(install_folder = "~/.local/bin/") {

#' Check suggested packages for CLI usage
#'
#' The {docopt} and {remotes} packages are required to run hotwater from the command line.
#' The {docopt} package is required to run hotwater from the command line.
#'
#' @noRd
check_suggests <- function() {
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<!-- badges: start -->

[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![hotwater status badge](https://elianhugh.r-universe.dev/badges/hotwater)](https://elianhugh.r-universe.dev/hotwater)
[![Codecov test coverage](https://codecov.io/gh/ElianHugh/hotwater/branch/main/graph/badge.svg)](https://app.codecov.io/gh/ElianHugh/hotwater?branch=main)
[![R-CMD-check](https://github.com/ElianHugh/hotwater/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ElianHugh/hotwater/actions/workflows/R-CMD-check.yaml)

Expand Down
10 changes: 8 additions & 2 deletions man/install_hotwater.Rd

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

9 changes: 7 additions & 2 deletions man/uninstall_hotwater.Rd

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

19 changes: 15 additions & 4 deletions tests/testthat/test-middleware.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,20 @@ test_that("is_plumber_running works", {
test_that("autoreloader is attached", {
engine <- new_test_engine()
new_runner(engine)
resp <- httr2::request(sprintf("localhost:%s", engine$config$port)) |>
httr2::req_perform() |>
httr2::resp_body_html()
expect_true(grepl(resp, pattern = "<script>"))
resp <- sprintf("localhost:%s", engine$config$port) |>
httr2::request() |>
httr2::req_perform()
expect_no_error(
httr2::resp_check_content_type(
resp,
valid_types = "text/html"
)
)
expect_true(
grepl(
httr2::resp_body_string(resp),
pattern = "<script>"
)
)
cleanup_test_engine(engine)
})

0 comments on commit 4bf0b6d

Please sign in to comment.