Skip to content

Commit

Permalink
fix issue when no dependencies in DESCRIPTION
Browse files Browse the repository at this point in the history
  • Loading branch information
ahasverus committed Jan 24, 2024
1 parent a8ccad0 commit 3445af5
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions R/add_deps.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,22 @@ add_deps <- function() {

all_deps <- c(descr_depends, descr_imports, descr_suggests)

versions <- strsplit(all_deps, "\\s{0,}\\(|\\)")

is_version <- unlist(lapply(versions, function(x) {
if (length(x) == 2) TRUE else FALSE
}))

versions <- versions[is_version]
pkg_names <- unlist(lapply(versions, function(x) x[1]))
pkg_versions <- unlist(lapply(versions, function(x) x[2]))
if (!is.null(all_deps)) {

versions <- strsplit(all_deps, "\\s{0,}\\(|\\)")

is_version <- unlist(lapply(versions, function(x) {
if (length(x) == 2) TRUE else FALSE
}))

versions <- versions[is_version]
pkg_names <- unlist(lapply(versions, function(x) x[1]))
pkg_versions <- unlist(lapply(versions, function(x) x[2]))

} else {

pkg_versions <- NULL
}


## Add version to packages ----
Expand Down

0 comments on commit 3445af5

Please sign in to comment.