Skip to content

Commit

Permalink
Just added to the org table and moved the dropping.
Browse files Browse the repository at this point in the history
  • Loading branch information
muschellij2 committed Sep 7, 2017
1 parent 631849f commit 79b037a
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
^\.Rproj\.user$
^\.travis\.yml$
^appveyor\.yml$
travis_job_timings\.R
org_table\.R
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
Version: 0.7.2
Author: John Muschelli
Maintainer: John Muschelli <muschellij2@gmail.com>
Description: Interfaces and compares things on 'GitHub'
Expand Down
2 changes: 1 addition & 1 deletion R/binary_release_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
32 changes: 21 additions & 11 deletions R/install_remotes_no_dep.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
35 changes: 35 additions & 0 deletions org_table.R
Original file line number Diff line number Diff line change
@@ -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)
}



59 changes: 59 additions & 0 deletions travis_job_timings.R
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 79b037a

Please sign in to comment.