Skip to content

Commit

Permalink
Merge pull request #1200 from jimhester/feature/protocol
Browse files Browse the repository at this point in the history
Fully specify host url for install_github.  

Fixes #1131. Closes #1142
  • Loading branch information
hadley committed Jun 3, 2016
2 parents ca34be3 + 4630239 commit d802383
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

* `install_dev_deps()` gets everything you need to start development on source
package - it installs all dependencies, and roxygen2 (#1193).
* `install_github()` now uses `https://api.github.com` as the host argument, so
users can specify 'http:' or other protocols if needed. (@jimhester, #1131, #1200)

* `build_vignette()` will now only install the "VignetteBuilder" if it's
not present, not try and upgrade it if it is (#1139).
Expand Down
8 changes: 4 additions & 4 deletions R/install-github.r
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
install_github <- function(repo, username = NULL,
ref = "master", subdir = NULL,
auth_token = github_pat(quiet),
host = "api.github.com", quiet = FALSE,
host = "https://api.github.com", quiet = FALSE,
...) {

remotes <- lapply(repo, github_remote, username = username, ref = ref,
Expand All @@ -65,7 +65,7 @@ install_github <- function(repo, username = NULL,

github_remote <- function(repo, username = NULL, ref = NULL, subdir = NULL,
auth_token = github_pat(), sha = NULL,
host = "api.github.com") {
host = "https://api.github.com") {

meta <- parse_git_repo(repo)
meta <- github_resolve_ref(meta$ref %||% ref, meta)
Expand All @@ -91,7 +91,7 @@ github_remote <- function(repo, username = NULL, ref = NULL, subdir = NULL,
#' @export
remote_download.github_remote <- function(x, quiet = FALSE) {
dest <- tempfile(fileext = paste0(".tar.gz"))
src_root <- paste0("https://", x$host, "/repos/", x$username, "/", x$repo)
src_root <- paste0(x$host, "/repos/", x$username, "/", x$repo)
src <- paste0(src_root, "/tarball/", x$ref)

if (!quiet) {
Expand All @@ -117,7 +117,7 @@ remote_download.github_remote <- function(x, quiet = FALSE) {
}

github_has_remotes <- function(x, auth = NULL) {
src_root <- paste0("https://", x$host, "/repos/", x$username, "/", x$repo)
src_root <- paste0(x$host, "/repos/", x$username, "/", x$repo)
src_submodules <- paste0(src_root, "/contents/.gitmodules?ref=", x$ref)
response <- httr::HEAD(src_submodules, , auth)
identical(httr::status_code(response), 200L)
Expand Down
4 changes: 2 additions & 2 deletions man/install_github.Rd

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

0 comments on commit d802383

Please sign in to comment.