Skip to content

Commit

Permalink
updated to install missing
Browse files Browse the repository at this point in the history
  • Loading branch information
muschellij2 committed Jun 20, 2017
1 parent 1315906 commit 2ed086f
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 26 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: ghtravis
Type: Package
Title: Interfaces with GitHub API and Travis
Version: 0.4.4.1
Version: 0.4.5
Author: John Muschelli
Maintainer: John Muschelli <muschellij2@gmail.com>
Description: Interfaces and compares things on 'GitHub'
Expand Down
12 changes: 12 additions & 0 deletions R/aaa_utils.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
null_if_empty = function(x) {
if (length(x) == 0 ) {
x = NULL
}
if (!is.null(x)) {
if (all(x == "")) {
x = NULL
}
}
return(x)
}

github_auth <- function(token) {
if (is.null(token)) {
NULL
Expand Down
7 changes: 1 addition & 6 deletions R/drop_remotes.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@ drop_remotes = function(
if (!is.null(drop_remotes)) {
remotes = remotes[!(pack_with_remote %in% drop_remotes)]
remotes = paste(remotes, collapse = ", ")
if (length(remotes) == 0 ) {
remotes = NULL
}
if (all(remotes == "")) {
remotes = NULL
}
remotes = null_if_empty(remotes)
} else {
remotes = NULL
}
Expand Down
14 changes: 7 additions & 7 deletions R/remote_order.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@ remote_order = function(
...,
max_iter = 200){

repo = get_remotes(path = path)
if (length(repo) == 0) {
remotes = get_remotes(path = path)
if (length(remotes) == 0) {
return(NULL)
}
parsed = parse_remotes(repo)
parsed = parse_remotes(remotes)
all_packs = sapply(parsed, `[[`, "repo")

L = remote_package_deps(
repo = repo,
remotes = remotes,
dependencies = c("Depends", "Imports"),
...)
packs = names(L)
stopifnot(all(all_packs %in% packs))
names(repo) = packs
names(remotes) = packs
dep_mat = sapply(L, function(x) {
packs %in% x$name
})
rownames(dep_mat) = packs

install_order = list()
i = 1
while(length(packs) > 0) {
while (length(packs) > 0) {
graph = igraph::graph_from_adjacency_matrix(
dep_mat,
mode = "directed")
Expand All @@ -59,7 +59,7 @@ remote_order = function(
}
}
install_order = unlist(install_order)
remotes = repo[ install_order]
remotes = remotes[ install_order]
return(remotes)
}

Expand Down
10 changes: 5 additions & 5 deletions R/remote_package_dcf.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Read Remote Package DESCRIPTION file
#'
#' @param repo Repository name
#' @param remotes Repository name
#' @param pat GitHub Personal Authentication Token (PAT)
#' @param url URL for repo - github
#' @param ... not used
Expand All @@ -12,19 +12,19 @@
#' get_remote_package_dcf("stnava/ANTsRCore")
#' remote_package_dcf("stnava/ANTsRCore")
get_remote_package_dcf = function(
repo,
remotes,
pat = NULL,
url = "https://github.com",
...) {
if (is.null(pat)) {
pat = devtools::github_pat(quiet = TRUE)
}

if (length(repo) > 1) {
res = lapply(repo, get_remote_package_dcf, pat = pat, url = url, ...)
if (length(remotes) > 1) {
res = lapply(remotes, get_remote_package_dcf, pat = pat, url = url, ...)
return(res)
}
remote = parse_one_remote(repo)
remote = parse_one_remote(remotes)

tmp <- tempfile()
path <- paste(c(remote$username,
Expand Down
17 changes: 13 additions & 4 deletions R/remote_package_deps.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#' Get Remote Package Dependencies
#'
#' @param path Path to DESCRIPTION file
#' @param remotes Repository if one specific
#' @param dependencies List of dependencies to parse, passed to
#' \code{\link{get_dep_table}}
#' @param exclude_remotes exclude Remotes in dependency table
Expand All @@ -20,14 +21,22 @@
#' @export
all_remote_package_deps = function(
path = "DESCRIPTION",
remotes = NULL,
...,
dependencies = c("Depends", "Imports",
"LinkingTo", "Suggests"),
exclude_remotes = TRUE) {
repo = get_remotes(path = path)
L = remote_package_deps(repo = repo,
dependencies = dependencies,
...)
remotes = null_if_empty(remotes)

if (is.null(remotes)) {
remotes = get_remotes(path = path)
} else {
message("Repositories are given, overriding path")
}
L = remote_package_deps(
remotes = remotes,
dependencies = dependencies,
...)
packs = names(L)
deps = do.call("rbind", L)
rownames(deps) = NULL
Expand Down
4 changes: 3 additions & 1 deletion man/all_remote_package_deps.Rd

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

4 changes: 2 additions & 2 deletions man/get_remote_package_dcf.Rd

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

0 comments on commit 2ed086f

Please sign in to comment.