Added support for a GitHub Personal API Access token
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
parent
0fa5c47d7f
commit
08388b149e
@ -459,6 +459,12 @@ can take several different forms:
|
|||||||
directories. TextMate can handle this correctly in project mode, but many
|
directories. TextMate can handle this correctly in project mode, but many
|
||||||
editors will do strange things in this case.
|
editors will do strange things in this case.
|
||||||
|
|
||||||
|
* HOMEBREW\_GITHUB\_API\_TOKEN:
|
||||||
|
A personal GitHub API Access token, which you can be create at
|
||||||
|
<https://github.com/settings/applications>. If set, GitHub will allow you a
|
||||||
|
greater number of API requests. See
|
||||||
|
<http://developer.github.com/v3/#rate-limiting> for more information.
|
||||||
|
|
||||||
* HOMEBREW\_KEEP\_INFO:
|
* HOMEBREW\_KEEP\_INFO:
|
||||||
If set, Homebrew will not remove files from `share/info`, allowing them
|
If set, Homebrew will not remove files from `share/info`, allowing them
|
||||||
to be linked from the Cellar. To access these info files, prepend
|
to be linked from the Cellar. To access these info files, prepend
|
||||||
|
|||||||
@ -77,6 +77,7 @@ else
|
|||||||
MACOS = false
|
MACOS = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
HOMEBREW_GITHUB_API_TOKEN = ENV["HOMEBREW_GITHUB_API_TOKEN"]
|
||||||
HOMEBREW_USER_AGENT = "Homebrew #{HOMEBREW_VERSION} (Ruby #{RUBY_VERSION}-#{RUBY_PATCHLEVEL}; #{OS_VERSION})"
|
HOMEBREW_USER_AGENT = "Homebrew #{HOMEBREW_VERSION} (Ruby #{RUBY_VERSION}-#{RUBY_PATCHLEVEL}; #{OS_VERSION})"
|
||||||
|
|
||||||
HOMEBREW_CURL_ARGS = '-f#LA'
|
HOMEBREW_CURL_ARGS = '-f#LA'
|
||||||
|
|||||||
@ -260,7 +260,9 @@ module GitHub extend self
|
|||||||
def open url, headers={}, &block
|
def open url, headers={}, &block
|
||||||
require 'open-uri'
|
require 'open-uri'
|
||||||
begin
|
begin
|
||||||
Kernel.open(url, {'User-Agent' => HOMEBREW_USER_AGENT}.merge(headers), &block)
|
default_headers = {'User-Agent' => HOMEBREW_USER_AGENT}
|
||||||
|
default_headers['Authorization'] = "token #{HOMEBREW_GITHUB_API_TOKEN}" if HOMEBREW_GITHUB_API_TOKEN
|
||||||
|
Kernel.open(url, default_headers.merge(headers), &block)
|
||||||
rescue OpenURI::HTTPError => e
|
rescue OpenURI::HTTPError => e
|
||||||
if e.io.meta['x-ratelimit-remaining'].to_i <= 0
|
if e.io.meta['x-ratelimit-remaining'].to_i <= 0
|
||||||
require 'vendor/multi_json'
|
require 'vendor/multi_json'
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
.\" generated with Ronn/v0.7.3
|
.\" generated with Ronn/v0.7.3
|
||||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||||
.
|
.
|
||||||
.TH "BREW" "1" "April 2013" "Homebrew" "brew"
|
.TH "BREW" "1" "May 2013" "Homebrew" "brew"
|
||||||
.
|
.
|
||||||
.SH "NAME"
|
.SH "NAME"
|
||||||
\fBbrew\fR \- The missing package manager for OS X
|
\fBbrew\fR \- The missing package manager for OS X
|
||||||
@ -500,6 +500,10 @@ If set, Homebrew will use this editor when editing a single formula, or several
|
|||||||
\fINOTE\fR: \fBbrew edit\fR will open all of Homebrew as discontinuous files and directories\. TextMate can handle this correctly in project mode, but many editors will do strange things in this case\.
|
\fINOTE\fR: \fBbrew edit\fR will open all of Homebrew as discontinuous files and directories\. TextMate can handle this correctly in project mode, but many editors will do strange things in this case\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
|
HOMEBREW_GITHUB_API_TOKEN
|
||||||
|
A personal GitHub API Access token, which you can be create at \fIhttps://github\.com/settings/applications\fR\. If set, GitHub will allow you a greater number of API requests\. See \fIhttp://developer\.github\.com/v3/#rate\-limiting\fR for more information\.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
HOMEBREW_KEEP_INFO
|
HOMEBREW_KEEP_INFO
|
||||||
If set, Homebrew will not remove files from \fBshare/info\fR, allowing them to be linked from the Cellar\. To access these info files, prepend \fBshare/info\fR to your \fBINFOPATH\fR environment variable\.
|
If set, Homebrew will not remove files from \fBshare/info\fR, allowing them to be linked from the Cellar\. To access these info files, prepend \fBshare/info\fR to your \fBINFOPATH\fR environment variable\.
|
||||||
.
|
.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user