Skip to content
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

Prepare next release #12

Merged
merged 92 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
00136e2
Consider that a CRAN package was removed
hsonne May 30, 2021
404fdcc
Add argument "dbg" to cranVersions()
hsonne May 30, 2021
84e1f85
Do not use isOnCran() to avoid duplicated calls
hsonne May 30, 2021
146e140
Cache DESCRIPTION files in tempdir()
hsonne May 30, 2021
2768ff7
Merge branch 'dev' of https://github.com/kwb-r/kwb.package into dev
hsonne Jan 22, 2024
007aa16
Refactor loadDescriptionFromArchiveUrl()
hsonne Jan 22, 2024
d504ed3
Refactor readGithubPackageDescription()
hsonne Jan 22, 2024
0aa59ee
Improve loadDescriptionFromWeb()
hsonne Jan 22, 2024
cf2c248
Add (undocumented) function allDeps()
hsonne Jan 22, 2024
fa0add3
Add plot.package_versions()
hsonne Jan 22, 2024
4a07220
Improve variable names (correct spelling!)
hsonne Jan 22, 2024
f1e1fbd
Bring function definitions into lexical order
hsonne Jan 22, 2024
df7897a
Provide local functions with getFromNamespace()
hsonne Jan 22, 2024
326b3ad
Do not import packages that are not used
hsonne Jan 22, 2024
6c23fb8
Function is exported, no need for ":::"
hsonne Jan 22, 2024
c6dd912
Try to "repair" loadDescriptionFromWeb()
hsonne Jan 22, 2024
8353dc2
Merge branch 'master' into dev
hsonne Jan 22, 2024
9b98c0d
Update RoxygenNote
hsonne Jan 22, 2024
1a2aae0
Remove arg "pattern" from sortedDependencies()
hsonne Jan 22, 2024
990a495
Evaluate pattern out of sortedDependencies()
hsonne Jan 22, 2024
0cd442c
Use helper variable "isLeaf"
hsonne Jan 22, 2024
f146b24
Simplify the sapply() call
hsonne Jan 22, 2024
2d835f1
No need for "> 0" in while() condition check
hsonne Jan 22, 2024
71d0c99
Add a comment
hsonne Jan 22, 2024
22d0023
Allow for more than one package and export
hsonne Jan 22, 2024
1ec3fb6
Export plot.package_versions(), TODO: document!
hsonne Apr 9, 2024
d76a0d9
Add "Tutorial" vignette, start with slack post
hsonne Apr 9, 2024
0093cf3
Indicate dev version in version number
hsonne Apr 11, 2024
488dcfc
Replace master with v2 in actions yaml
hsonne Apr 11, 2024
1a08a9e
Fix GH axtion by using "v2"
mrustl Apr 11, 2024
8c8f974
Fix Rcmdcheck by getting rid of "dot" in function
mrustl Apr 11, 2024
958b672
Move CRAN-related functions to cran_helpers.R
hsonne Apr 12, 2024
6279815
Use getPath() for two more URLs
hsonne Apr 12, 2024
063e438
Move non-general functions to extra files
hsonne Apr 12, 2024
c488445
Use kwb.utils::stopFormatted()
hsonne Apr 12, 2024
37a853a
Consistently use clanStop(), old: stop_()
hsonne Apr 12, 2024
fb883de
Move cranVersions() to extra file
hsonne Apr 12, 2024
c1fe536
Provide all used kwb.utils functions locally
hsonne Apr 12, 2024
6ded85e
Update project settings
hsonne Apr 12, 2024
ff0f01d
Add/export getCranPackageDatabase()
hsonne Apr 12, 2024
e5a304f
Fix :bug:: replace getPath() with getUrl()
hsonne Apr 12, 2024
9e76549
Fix and export cranVersions()
hsonne Apr 12, 2024
1df4525
Add missing "shortcuts" to kwb.utils functions
hsonne Apr 12, 2024
ea99c97
Extend separator line
hsonne Apr 12, 2024
485449f
Add both, selectColumns() and selectElements()
hsonne Apr 12, 2024
abac018
Give githubVersions() a title
hsonne Apr 12, 2024
819903e
Document readGithubPackageDescription()
hsonne Apr 12, 2024
763d577
Fix :bug: in readGithubPackageDescription()
hsonne Apr 12, 2024
4f9fd8c
Add two function calls to the tutorial
hsonne Apr 12, 2024
b7940db
Update documentation
hsonne Apr 12, 2024
37bc47d
Add magrittr's pipe operator
hsonne Apr 12, 2024
e3bce7f
Add getPackageLicences()
hsonne Apr 12, 2024
58aeca4
Use base packages to let vignette pass
hsonne Apr 12, 2024
636d767
Set mustWork = TRUE
hsonne Apr 12, 2024
82e10f1
Do not convert "package" column to a factor
hsonne Apr 16, 2024
8db98c3
Move readDescription() to helpers.R
hsonne Apr 16, 2024
112c4d8
Add getAuthors()
hsonne Apr 16, 2024
22ba3c2
Add arguments "db", "which", "by.type"
hsonne Apr 26, 2024
c9f0017
Rename "license" to "licence" (British English)
hsonne Apr 26, 2024
5ba96cd
Improve error handling
hsonne Apr 26, 2024
bf606a5
Add hasGplLicence()
hsonne Apr 26, 2024
d64c786
Extract packageDependenciesByType()
hsonne Apr 26, 2024
59b1931
Define "shortcuts" to all kwb.utils functions
hsonne Apr 26, 2024
5578f0e
Move packageDependenciesByType() to its own file
hsonne Apr 30, 2024
72eea3a
Add argument "stop.on.error"
hsonne Apr 30, 2024
062cdce
Rename "which.one" to "type"
hsonne Apr 30, 2024
4531ea3
Read from package db, not from DESCRIPTIONS
hsonne Apr 30, 2024
b43763e
Do not lookup licenses
hsonne May 2, 2024
cebc736
Create tests with kwb.test::create_test_files()
hsonne May 2, 2024
f7f9159
Set env SERVERNAME. Does this fix R CMD Check?
hsonne May 3, 2024
49d8de4
Set default radius to 1, multiply with vector
hsonne May 3, 2024
a0fd4ca
Cosmetics
hsonne May 3, 2024
1acd146
Move functions to utils.R
hsonne May 3, 2024
762746a
Do not specify your own package
hsonne May 3, 2024
17d4d17
Fix function name (caused by "copy and paste")
hsonne May 3, 2024
8895c5b
Fix (again) function name
hsonne May 3, 2024
01acd16
Update Rd files
hsonne May 3, 2024
7381792
Update NEWS
hsonne May 3, 2024
2856640
Reuse polar_to_xy()
hsonne May 3, 2024
5816edc
Rename plot.R to plotAllDependencies.R
hsonne May 3, 2024
c53b959
Renam "nodeColours" to "col"
hsonne May 3, 2024
86add80
Rename "stopNode(s)" to "endNode(s)"
hsonne May 3, 2024
0f4ea2c
Omit intermediate variable
hsonne May 3, 2024
201d17f
Update Rd files
hsonne May 3, 2024
0f473d5
Remove drawLink()
hsonne May 3, 2024
9acf3d0
Do not track Rplots.pdf
hsonne May 3, 2024
dd1df74
Rename packageNames to nodeNames
hsonne May 3, 2024
9556248
Fix keyword in getCranPackageDatabase()
hsonne May 3, 2024
ec4b3dc
Add getDependencyData()
hsonne May 3, 2024
96c57c5
Analyse only fields that exist in db
hsonne May 3, 2024
2a518bf
Return version and all licence columns
hsonne May 5, 2024
4a4c250
Set version number to 0.4.0
hsonne May 5, 2024
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
7 changes: 4 additions & 3 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
SERVERNAME: 'kwb-servername'

steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@master
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}

- uses: r-lib/actions/setup-pandoc@master
- uses: r-lib/actions/setup-pandoc@v2

- name: Query dependencies
run: |
Expand Down Expand Up @@ -76,7 +77,7 @@ jobs:

- name: Upload check results
if: failure()
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
4 changes: 2 additions & 2 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@master
- uses: r-lib/actions/setup-r@v2

- uses: r-lib/actions/setup-pandoc@master
- uses: r-lib/actions/setup-pandoc@v2

- name: Query dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@master
- uses: r-lib/actions/setup-r@v2

- uses: r-lib/actions/setup-pandoc@master
- uses: r-lib/actions/setup-pandoc@v2

- name: Query dependencies
run: |
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
.Rhistory
.RData
.Ruserdata
R/\.*
R/\.*
inst/doc
tests/testthat/Rplots.pdf
14 changes: 9 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: kwb.package
Title: Install / Unstall KWB Packages and Show Package Dependencies
Version: 0.3.0
Version: 0.4.0
Authors@R: c(
person("Hauke", "Sonnenberg", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-9134-2871")),
Expand All @@ -19,19 +19,23 @@ License: MIT + file LICENSE
URL: https://github.com/kwb-r/kwb.package
BugReports: https://github.com/kwb-r/kwb.package/issues
Imports:
devtools,
gh,
jsonlite,
kwb.utils (>= 0.5.0),
magrittr,
mvbutils,
networkD3,
remotes,
withr
Suggests:
covr,
pkgmeta
knitr,
pkgmeta,
rmarkdown,
testthat (>= 3.0.0)
Remotes:
github::kwb-r/kwb.utils,
github::kwb-r/pkgmeta
Encoding: UTF-8
RoxygenNote: 7.1.2
RoxygenNote: 7.3.1
VignetteBuilder: knitr
Config/testthat/edition: 3
28 changes: 24 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,35 +1,45 @@
# Generated by roxygen2: do not edit by hand

export("%>%")
export(addNodeLabels)
export(anglesToPoints)
export(archivedCranVersions)
export(compareInstalledVersions)
export(copyBasePackages)
export(cranVersions)
export(detachAllNonSystemPackages)
export(detachRecursively)
export(downloadGitHubPackage)
export(downloadPackagesFromSnapshot)
export(drawDependencies)
export(drawLink)
export(equidistantAngles)
export(exampleLinksAndNodes)
export(getAuthors)
export(getCranPackageDatabase)
export(getDependencyData)
export(getPackageFilesToInstall)
export(getPackageLicences)
export(getRVersionMajorMinor)
export(githubVersions)
export(gradToRad)
export(hasGplLicence)
export(initLocalCRAN)
export(installGithubPackages)
export(installRemotes)
export(installedDependencies)
export(installedKwbPackages)
export(packageDependencies)
export(packageDependenciesByType)
export(packageString)
export(plotAllDependencies)
export(plotDependencies)
export(plotNodes)
export(plotPackageVersions)
export(plotSankeyNetwork)
export(provideInLocalCRAN)
export(setOptionsForPackrat)
export(sortedDependencies)
export(stopIfNotInstalled)
export(systemPackages)
export(toLinksAndNodes)
export(toNodes)
Expand All @@ -38,23 +48,33 @@ importFrom(gh,gh)
importFrom(grDevices,rainbow)
importFrom(graphics,arrows)
importFrom(graphics,plot)
importFrom(kwb.utils,assignPackageObjects)
importFrom(kwb.utils,catAndRun)
importFrom(kwb.utils,catIf)
importFrom(kwb.utils,createDirectory)
importFrom(kwb.utils,defaultIfNA)
importFrom(kwb.utils,defaultIfNULL)
importFrom(kwb.utils,excludeNULL)
importFrom(kwb.utils,extractSubstring)
importFrom(kwb.utils,fullySorted)
importFrom(kwb.utils,getAttribute)
importFrom(kwb.utils,hsRenameColumns)
importFrom(kwb.utils,moveColumnsToFront)
importFrom(kwb.utils,get_homedir)
importFrom(kwb.utils,hsRestoreAttributes)
importFrom(kwb.utils,lastElement)
importFrom(kwb.utils,noFactorDataFrame)
importFrom(kwb.utils,noSuchElements)
importFrom(kwb.utils,orderBy)
importFrom(kwb.utils,rbindAll)
importFrom(kwb.utils,removeColumns)
importFrom(kwb.utils,renameColumns)
importFrom(kwb.utils,resetRowNames)
importFrom(kwb.utils,resolve)
importFrom(kwb.utils,runInDirectory)
importFrom(kwb.utils,safePath)
importFrom(kwb.utils,safeRowBind)
importFrom(kwb.utils,selectColumns)
importFrom(kwb.utils,selectElements)
importFrom(kwb.utils,stopFormatted)
importFrom(magrittr,"%>%")
importFrom(mvbutils,foodweb)
importFrom(networkD3,sankeyNetwork)
importFrom(remotes,github_remote)
Expand Down
54 changes: 54 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,57 @@
# Current Development

# [kwb.package 0.4.0](https://github.com/KWB-R/kwb.package/releases/tag/v0.4.0) <small>2024-05-05</small>

The following public functions were added:

- getAuthors()
- getCranPackageDatabase()
- getDependencyData()
- getPackageLicences()
- hasGplLicence()
- packageDependenciesByType()
- plotPackageVersions()
- sortedDependencies(): Was private before. The argument "pattern" is no longer
supported.
- stopIfNotInstalled()

The following public functions were modified:

- packageDependencies: add arguments "db", "which", "verbose"

The following public functions were deleted:

- drawLink(): It was a one-liner and only used once within the package

The following private functions were added:

- allDeps()
- draw_circles()
- map_to_range()
- pathDescription()
- polar_to_xy()
- readDescription()
- remotes_github_pat() -> remotes:::github_pat()
- remotes_parse_deps() -> remotes:::parse_deps()
- remotes_read_dcf() -> remotes:::read_dcf()
- remotes_untar_description() -> remotes:::untar_description()
- seq_rad_len()
- untarDescriptionFromUrl()

The following private functions were modified:

- cranVersions(): add argument "dbg"
- loadDescriptionFromArchiveUrl(): add argument "path"
- loadDescriptionFromWeb(): add arguments "path", "cache"
- readGithubPackageDescription: add argument "destdir"
- stop_(): rename to cleanStop()

Further changes:

- Add Tests
- Add vignette "Tutorial"
- Update GitHub action files (e.g. master -> v2)

# [kwb.package 0.3.0](https://github.com/KWB-R/kwb.package/releases/tag/v0.3.0) <small>2022-06-11</small>

* Harmonise with R package [kwb.pkgbuild](https://kwb-r.github.io/kwb.pkgbuild)
Expand Down
41 changes: 41 additions & 0 deletions R/allDeps.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# allDeps ----------------------------------------------------------------------
allDeps <- function(
name,
version = NA,
depth = 1L,
max_depth = 9L,
cache = list()
)
{
pkg <- loadDescriptionFromWeb(name, version)

stopifnot(is.na(version) || identical(version, pkg$version))

deps <- parsePackageDeps(pkg)

if (inherits(deps, "try-error") || nrow(deps) == 0L) {
return(NULL)
}

message("depth: ", depth)

deps$depth <- depth
deps$namever <- paste(name, version, sep = ":")

if (depth == max_depth) {
message("maximum depth (", max_depth, ") reached.")
return(deps)
}

child_deps <- lapply(seq_len(nrow(deps)), function(i) {
allDeps(deps$name[i], deps$version[i], depth + 1L, max_depth)
})

child_deps <- excludeNull(child_deps, dbg = FALSE)

if (length(child_deps) > 0L) {
deps <- rbind(deps, do.call(rbind, child_deps))
}

deps
}
75 changes: 4 additions & 71 deletions R/archivedCranVersions.R
Original file line number Diff line number Diff line change
@@ -1,76 +1,10 @@
# isOnCran ---------------------------------------------------------------------
isOnCran <- function(name)
{
nrow(currentCranVersion(name)) > 0L
}

# cranVersions -----------------------------------------------------------------
#' @noMd
#' @noRd
#' @keywords internal
#' @importFrom kwb.utils removeColumns safeRowBind
cranVersions <- function(name)
{
current <- currentCranVersion(name)

if (nrow(current) == 0L) {
message(sprintf("Package '%s' does not seem to be on CRAN.", name))
return(NULL)
}

archived <- archivedCranVersions(name)

current$package_source_url <- getUrl(
"cran_package_file", package = name, version = current$version
)

archived$package_source_url <- sprintf(
getUrl("cran_archive_file", package = name, package_filename = "%s"),
archived$archive_file
)

result <- kwb.utils::safeRowBind(archived, current)

kwb.utils::removeColumns(result, "archive_file")
}

# currentCranVersion -----------------------------------------------------------
#' @noMd
#' @noRd
#' @keywords internal
#' @importFrom kwb.utils noFactorDataFrame
currentCranVersion <- function(name)
{
src <- readLinesFromUrl(getUrl("cran_package", package = name))

if (is.null(src)) {
return(kwb.utils::noFactorDataFrame(
package = character(0L),
version = character(0L),
date = as.Date(character(0L)),
date_type = character(0L)
))
}

extract <- function(x) {
gsub("<td>|</td>", "", src[grep(sprintf("<td>%s:</td>", x), src) + 1L])
}

kwb.utils::noFactorDataFrame(
package = name,
version = extract("Version"),
date = as.Date(extract("Published")),
date_type = "published"
)
}
# archivedCranVersions ---------------------------------------------------------

#' archivedCranVersions --------------------------------------------------------
#' Archived CRAN versions
#'
#' @param package package name
#' @param ref_date default: NULL
#' @export
#' @importFrom kwb.utils extractSubstring noFactorDataFrame
#' @examples
#' packages <- c("ggplot2", "swmmr", "kwb.hantush")
#' archivedCranVersions(packages)
Expand All @@ -86,7 +20,7 @@ archivedCranVersions <- function(package, ref_date = NULL)
src <- readLinesFromUrl(getUrl("cran_archive", package = package))

if (is.null(src)) {
return(kwb.utils::noFactorDataFrame(
return(noFactorDataFrame(
package = character(0L),
version = character(0L),
date = as.Date(character(0L)),
Expand All @@ -99,7 +33,7 @@ archivedCranVersions <- function(package, ref_date = NULL)
"href=\"(%s_(.*)\\.tar\\.gz)\".*(\\d{4}-\\d{2}-\\d{2}) ", package
)

versions <- cbind(package = package, kwb.utils::extractSubstring(
versions <- cbind(package = package, extractSubstring(
pattern = pattern,
x = grep(pattern, src, value = TRUE),
index = c(
Expand All @@ -124,12 +58,11 @@ archivedCranVersions <- function(package, ref_date = NULL)
#' @noRd
#' @keywords internal
#' @importFrom utils tail
#' @importFrom kwb.utils resetRowNames
getLastVersionBefore <- function(version_dates, ref_date)
{
X = unname(split(version_dates, version_dates$package))

last_before <- function(x) utils::tail(x[x$date <= ref_date, ], 1L)

kwb.utils::resetRowNames(do.call(rbind, lapply(X, last_before)))
resetRowNames(do.call(rbind, lapply(X, last_before)))
}
Loading
Loading