diff options
| author | David MacMahon | 2013-10-22 16:18:31 -0700 |
|---|---|---|
| committer | Mike McQuaid | 2013-10-25 21:12:28 +0100 |
| commit | a999ddc002af970b12e8472daa3677c1c2e093c5 (patch) | |
| tree | 4918b88db8bb39d5303cbd507ce49d549da32e9e /Library/Homebrew/utils.rb | |
| parent | 5b433bb05a8b9010493a58ea6fe475596dfa06e9 (diff) | |
| download | brew-a999ddc002af970b12e8472daa3677c1c2e093c5.tar.bz2 | |
Add HOMEBREW_NO_GITHUB_API env var.
This patch allows users to "opt out" of using the GitHub API altogether
by setting the HOMEBREW_NO_GITHUB_API environment variable. The
value of the environment variable does not matter (it can even be
empty!).
For Bash/ZSH: export HOMEBREW_NO_GITHUB_API=1
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Homebrew/utils.rb')
| -rw-r--r-- | Library/Homebrew/utils.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index f3ac5e447..97dd708af 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -254,6 +254,9 @@ module GitHub extend self Error = Class.new(StandardError) def open url, headers={}, &block + # This is a no-op if the user is opting out of using the GitHub API. + return if ENV['HOMEBREW_NO_GITHUB_API'] + require 'net/https' # for exception classes below default_headers = {'User-Agent' => HOMEBREW_USER_AGENT} @@ -296,6 +299,9 @@ module GitHub extend self end def find_pull_requests rx + return if ENV['HOMEBREW_NO_GITHUB_API'] + puts "Searching open pull requests..." + query = rx.source.delete('.*').gsub('\\', '') each_issue_matching(query) do |issue| |
