Skip to content

Commit

Permalink
Define "shortcuts" to all kwb.utils functions
Browse files Browse the repository at this point in the history
  • Loading branch information
hsonne committed Apr 26, 2024
1 parent d64c786 commit 59b1931
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 29 deletions.
9 changes: 5 additions & 4 deletions R/detach.R
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ packageDependenciesByType <- function(
reverse = reverse,
verbose = verbose
) %>%
do.call(what = rbind)
do.call(what = rbind) %>%
resetRowNames()
)
}

Expand All @@ -209,14 +210,14 @@ packageDependenciesByType <- function(
) %>%
cbind(
getPackageLicences(dependencies) %>%
kwb.utils::renameColumns(list(package = "dependency"))
renameColumns(list(package = "dependency"))
)
} # else NULL
}) %>%
stats::setNames(which) %>%
kwb.utils::excludeNULL(dbg = FALSE) %>%
excludeNULL(dbg = FALSE) %>%
do.call(what = rbind.data.frame) %>%
kwb.utils::resetRowNames()
resetRowNames()
}

# printAndWaitIf ---------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions R/getPackageLicences.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ getPackageLicences <- function(packages)
fields <- c("licence", "license")
columns <- intersect(colnames(description), fields)
as.data.frame(description[, columns, drop = FALSE]) %>%
kwb.utils::renameColumns(list(
renameColumns(list(
license = "licence"
))
}) %>%
stats::setNames(packages) %>%
kwb.utils::rbindAll(nameColumn = "package", namesAsFactor = FALSE) %>%
kwb.utils::moveColumnsToFront("package")
rbindAll(nameColumn = "package", namesAsFactor = FALSE) %>%
moveColumnsToFront("package")
}
6 changes: 3 additions & 3 deletions R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ githubRepo <- function(github_user, name)
hasGplLicence <- function(packages)
{
getPackageLicences(packages) %>%
kwb.utils::selectColumns("licence") %>%
selectColumns("licence") %>%
grep(pattern = "GPL", ignore.case = TRUE)
}

Expand Down Expand Up @@ -75,7 +75,7 @@ readDescription <- function(package)
stopIfNotInstalled(package)

description <- system.file("DESCRIPTION", package = package) %>%
kwb.utils::safePath() %>%
safePath() %>%
read.dcf()

colnames(description) <- tolower(colnames(description))
Expand All @@ -95,6 +95,6 @@ stopIfNotInstalled <- function(package)
available <- rownames(installed.packages())

if (!package %in% available) {
kwb.utils::stopFormatted("The package '%s' is not installed.", package)
stopFormatted("The package '%s' is not installed.", package)
}
}
4 changes: 2 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ restoreAttributes <- kwb.utils::hsRestoreAttributes

# runInDirectory ---------------------------------------------------------------
#' @importFrom kwb.utils runInDirectory
kwb.utils::runInDirectory
runInDirectory <- kwb.utils::runInDirectory

# safePath ---------------------------------------------------------------------
#' @importFrom kwb.utils safePath
kwb.utils::safePath
safePath <- kwb.utils::safePath

# safeRowBind ------------------------------------------------------------------
#' @importFrom kwb.utils safeRowBind
Expand Down
17 changes: 0 additions & 17 deletions man/reexports.Rd

This file was deleted.

0 comments on commit 59b1931

Please sign in to comment.