Skip to content

Commit

Permalink
Forcing the binary_release_table.
Browse files Browse the repository at this point in the history
  • Loading branch information
muschellij2 committed Sep 8, 2017
1 parent 79b037a commit fb8e922
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 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 CI
Version: 0.7.2
Version: 0.8
Author: John Muschelli
Maintainer: John Muschelli <muschellij2@gmail.com>
Description: Interfaces and compares things on 'GitHub'
Expand Down
27 changes: 23 additions & 4 deletions R/binary_release_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#' @param repo Remote repository name
#' @param pat GitHub Personal Authentication Token (PAT)
#' @param verbose print diagnostic messages
#' @param force if TRUE, then \code{binary_table_no_tags} will return
#' the table even if no assets are in the release
#'
#' @param ... additional arguments to \code{\link[httr]{GET}}
#' @return \code{data.frame} of binary releases
Expand All @@ -18,6 +20,7 @@
binary_release_table = function(
repo,
pat = NULL,
force = FALSE,
verbose = TRUE,
...){

Expand Down Expand Up @@ -49,7 +52,9 @@ binary_release_table = function(
print(tag_content)
}

df = binary_table_no_tags(repo = xrepo, pat = pat, ...)
df = binary_table_no_tags(repo = xrepo, pat = pat,
force = force,
verbose = verbose, ...)
if (verbose) {
message("binary_table_no_tags is ")
print(df)
Expand All @@ -58,7 +63,8 @@ binary_release_table = function(
return(NA)
}

cn = c("url", "assets_url", "asset_updated_at", "asset_created_at",
cn = c("url", "assets_url", "upload_url",
"id", "asset_updated_at", "asset_created_at",
"tag_name", "created_at", "published_at",
"asset_name", "asset_label", "asset_download_count",
"asset_browser_download_url")
Expand Down Expand Up @@ -95,9 +101,12 @@ binary_release_table = function(
#' repo = "stnava/ANTsR"
#' binary_table_no_tags(repo)
#' binary_table_no_tags("muschellij2/ANTsR")
#' binary_table_no_tags("muschellij2/ANTsR", force = TRUE)
binary_table_no_tags = function(
repo,
pat = NULL,
force = FALSE,
verbose = TRUE,
...){

info = parse_one_remote(repo)
Expand All @@ -113,7 +122,9 @@ binary_table_no_tags = function(

res = httr::GET(url, github_auth(pat), ...)
httr::stop_for_status(res)
httr::message_for_status(res)
if (verbose) {
httr::message_for_status(res)
}

##########################
# all releases
Expand Down Expand Up @@ -141,7 +152,15 @@ binary_table_no_tags = function(
ret = merge(dd, assets, all = TRUE)
return(ret)
} else {
return(NULL)
if (force) {
assets = matrix(NA, ncol = length(assets_hdrs))
assets = data.frame(assets)
colnames(assets) = assets_hdrs
ret = cbind(df, assets)
return(ret)
} else {
return(NULL)
}
}
})
df = do.call("rbind", df)
Expand Down
8 changes: 6 additions & 2 deletions man/binary_release_table.Rd

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

0 comments on commit fb8e922

Please sign in to comment.