diff --git a/.Rbuildignore b/.Rbuildignore index e148253..3129543 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -2,3 +2,5 @@ ^\.Rproj\.user$ ^\.travis\.yml$ ^appveyor\.yml$ +travis_job_timings\.R +org_table\.R diff --git a/DESCRIPTION b/DESCRIPTION index 3d1ccab..78ea40d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: ghtravis Type: Package Title: Interfaces with GitHub API and Travis CI -Version: 0.7 +Version: 0.7.2 Author: John Muschelli Maintainer: John Muschelli Description: Interfaces and compares things on 'GitHub' diff --git a/R/binary_release_table.R b/R/binary_release_table.R index 6d573a5..52a1a09 100644 --- a/R/binary_release_table.R +++ b/R/binary_release_table.R @@ -58,7 +58,7 @@ binary_release_table = function( return(NA) } - cn = c("asset_updated_at", "asset_created_at", + cn = c("url", "assets_url", "asset_updated_at", "asset_created_at", "tag_name", "created_at", "published_at", "asset_name", "asset_label", "asset_download_count", "asset_browser_download_url") diff --git a/R/install_remotes_no_dep.R b/R/install_remotes_no_dep.R index c4f8375..4dc3b14 100644 --- a/R/install_remotes_no_dep.R +++ b/R/install_remotes_no_dep.R @@ -40,18 +40,28 @@ install_remotes_no_dep = function( if (all(remotes == "")) { return(NULL) } - if (drop) { - if (verbose) { - message("Dropping Remotes") - } - drop_remotes(path = path, drop_remotes = remotes, - reorder = reorder, - verbose = verbose) - } remotes = remotes[ !(remotes %in% "") ] - res = sapply(remotes, install_github, - auth_token = github_pat(quiet = TRUE), - upgrade_dependencies = FALSE, ...) + + + res = sapply(remotes, function(x) { + r = install_github( + repo = x, + auth_token = github_pat(quiet = TRUE), + upgrade_dependencies = FALSE, ...) + if (r) { + if (drop) { + if (verbose) { + message(paste0("Dropping Remote: ", x)) + } + drop_remotes( + path = path, + drop_remotes = x, + reorder = FALSE, + verbose = verbose) + } + } + return(r) + }) names(res) = remotes return(res) } \ No newline at end of file diff --git a/org_table.R b/org_table.R new file mode 100644 index 0000000..5ea6fe3 --- /dev/null +++ b/org_table.R @@ -0,0 +1,35 @@ +library(gh) +library(ghtravis) + +organization = "adv-datasci" +assignment = "homework1" +pat = NULL +github_auth = ghtravis:::github_auth + +org_table = function(organization, pat = NULL, ...) { + if (is.null(pat)) { + pat = devtools::github_pat(quiet = TRUE) + } + + tag_url = paste0("https://api.github.com/orgs/", organization, "/repos") + tag_res = httr::GET(tag_url, github_auth(pat) + ) + # , ...) + httr::stop_for_status(tag_res) + httr::message_for_status(tag_res) + tag_content = httr::content(tag_res) + + + tag_content = bind_list(tag_content) + # if (!is.null(tag_content)) { + # if (ncol(tag_content) > 0) { + # cn = colnames(tag_content) + # cn[ cn == "name"] = "tag_name" + # colnames(tag_content) = cn + # } + # } + return(tag_content) +} + + + diff --git a/travis_job_timings.R b/travis_job_timings.R new file mode 100644 index 0000000..24f550d --- /dev/null +++ b/travis_job_timings.R @@ -0,0 +1,59 @@ +library(httr) +library(tidyr) +library(dplyr) + +# file = "https://s3.amazonaws.com/archive.travis-ci.org/jobs/269241330/log.txt?X-Amz-Expires=30&X-Amz-Date=20170828T163440Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJRYRXRSVGNKPKO5A/20170828/us-east-1/s3/aws4_request&X-Amz-SignedHeaders=host&X-Amz-Signature=b24d4775d8ea506c604b1b20d934e53eba4954e1cf71abbcda1e2cf251176208" +job_id = "269241330" +file = paste0("https://api.travis-ci.org/jobs/", + job_id, + "/log.txt?deansi=true") +res = httr::GET(file) +x = content(res) + +log = unlist(strsplit(x, "\n")) +log = unlist(strsplit(log, "\r")) +log = trimws(log) +log = log[ !log %in% "" ] +#remove front non-ASCII +travis_terms = "travis_[time|fold]" +log = sub( + paste0(".*(", travis_terms, ".*)"), + "\\1", log) + +timings = grep(paste0("^", travis_terms), + log, value = TRUE) + +df = data_frame(timing = timings) +df = df %>% + separate( + timing, + into = c("travis_type", "type", "id", "info"), + sep = ":") +df$travis_type = sub("travis_", "", df$travis_type) + +id_df = df %>% + select(id) %>% + distinct() +id_df$ord = seq.int(nrow(id_df)) + +df = df %>% + spread(key = type, value = info) +df$start = NULL +df = df %>% + separate( + end, + into = c("start", "finish", "duration"), + sep = ",") +remove_equals = function(x) { + x = sub(".*=(.*)", "\\1", x) + x = as.numeric(x) +} +df = df %>% + mutate(start = remove_equals(start), + finish = remove_equals(finish), + duration = remove_equals(duration) + ) +df = left_join(df, id_df) +df = df %>% + arrange(ord) +