Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,21 @@

export(document_universe)
export(is_online)
importFrom(cli,cli_abort)
importFrom(cli,cli_warn)
importFrom(curl,curl_fetch_memory)
importFrom(curl,new_handle)
importFrom(dplyr,arrange)
importFrom(dplyr,case_when)
importFrom(dplyr,filter)
importFrom(dplyr,full_join)
importFrom(dplyr,mutate)
importFrom(dplyr,select)
importFrom(glue,glue)
importFrom(rlang,.data)
importFrom(rlang,is_attached)
importFrom(rlang,set_names)
importFrom(rlang,warn)
importFrom(tibble,as_tibble)
importFrom(utils,hsearch_db)
importFrom(utils,isS3method)
18 changes: 9 additions & 9 deletions R/document_universe.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ document_universe_impl <- function(x, url_template = NULL) {
}
if (length(url_template) > 2L) {
longer <- length(url_template)
cli::cli_abort("`url_template` must be of length 1 or 2, not {longer}.")
cli_abort("`url_template` must be of length 1 or 2, not {longer}.")
}


out <- mutate(
out,
topic = dplyr::case_when(
topic = case_when(
.data$type == "help" ~ to_href(
.data$topic,
template = glue::glue(manual)
template = glue(manual)
),
.data$type == "vignette" ~ to_href(
.data$topic,
template = glue::glue(vignettes_template(vignettes))
template = glue(vignettes_template(vignettes))
),
.default = .data$topic
)
Expand Down Expand Up @@ -109,13 +109,13 @@ vignettes_template <- function(template) {
#' document_universe(universe, template)
document_universe <- function(x, url_template = NULL) {
out <- document_universe_impl(x = x, url_template = url_template)
tibble::as_tibble(out)
as_tibble(out)
}

warn_unnattached <- function(x, doc = "package") {
if (!all(attached(x))) {
unattached <- x[!attached(x)] # nolint
cli::cli_warn(c(
cli_warn(c(
"All packages should be attached to work properly.",
x = "Not attached: {unattached}"
))
Expand Down Expand Up @@ -143,7 +143,7 @@ tidy_reference <- function(data, strip_s3class) {
}

attached <- function(x) {
unlist(lapply(glue("package:{x}"), rlang::is_attached))
unlist(lapply(glue("package:{x}"), is_attached))
}

abort_unavailable_package <- function(data, x) {
Expand All @@ -153,13 +153,13 @@ abort_unavailable_package <- function(data, x) {
}

is_unavailable <- x[!is_available] # nolint
cli::cli_abort("No pacakge matches '{is_unavailable}'.")
cli_abort("No pacakge matches '{is_unavailable}'.")
}

collapse_alias <- function(data, strip_s3class = FALSE) {
out <- mutate(
data,
alias = dplyr::case_when(
alias = case_when(
!strip_s3class ~ may_strip_s3class(.data$alias, .f = identity),
strip_s3class ~ may_strip_s3class(.data$alias, .f = s3_strip_class),
),
Expand Down
9 changes: 9 additions & 0 deletions R/dverse-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,23 @@
"_PACKAGE"

## usethis namespace: start
#' @importFrom cli cli_abort
#' @importFrom cli cli_warn
#' @importFrom curl curl_fetch_memory
#' @importFrom curl new_handle
#' @importFrom dplyr arrange
#' @importFrom dplyr case_when
#' @importFrom dplyr filter
#' @importFrom dplyr full_join
#' @importFrom dplyr mutate
#' @importFrom dplyr select
#' @importFrom glue glue
#' @importFrom rlang .data
#' @importFrom rlang is_attached
#' @importFrom rlang set_names
#' @importFrom rlang warn
#' @importFrom tibble as_tibble
#' @importFrom utils hsearch_db
#' @importFrom utils isS3method
## usethis namespace: end
NULL
2 changes: 1 addition & 1 deletion R/is_online.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ is_online <- function(x) {

is_online_once <- function(url) {
tryCatch(error = function(e) FALSE, {
response <- curl::curl_fetch_memory(url, handle = curl::new_handle())
response <- curl_fetch_memory(url, handle = new_handle())
identical(response$status_code, 200L)
})
}
Expand Down
4 changes: 2 additions & 2 deletions R/s3_strip_class.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ s3_strip_class_impl <- function(x) {

ok <- logical(nfc)
for (j in 2:nfc) {
ok[[j]] <- utils::isS3method(
ok[[j]] <- isS3method(
f = paste(f_c[1:(j - 1)], collapse = "."),
class = paste(f_c[j:nfc], collapse = ".")
)
Expand All @@ -31,5 +31,5 @@ s3_strip_class_impl <- function(x) {
}

is_s3_method <- function(x) {
ifelse(startsWith(x, "."), FALSE, utils::isS3method(x))
ifelse(startsWith(x, "."), FALSE, isS3method(x))
}
2 changes: 1 addition & 1 deletion R/search_documentation.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
search_documentation <- function() {
docs <- suppressMessages(
Reduce(dplyr::full_join, utils::hsearch_db())
Reduce(full_join, hsearch_db())
)

out <- set_names(docs, tolower)
Expand Down
Loading