Created
March 28, 2017 03:11
-
-
Save niratama/2659b1c7026ce83d26b4b3f8b47ed027 to your computer and use it in GitHub Desktop.
Homebrew Caskのandroid-sdk のCaskをproxy対応にするやっつけパッチ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Casks/android-sdk.rb b/Casks/android-sdk.rb | |
index 5cb6828a1..a72f49c2a 100644 | |
--- a/Casks/android-sdk.rb | |
+++ b/Casks/android-sdk.rb | |
@@ -24,7 +24,12 @@ cask 'android-sdk' do | |
binary "#{staged_path}/tools/traceview" | |
postflight do | |
- system_command "#{staged_path}/tools/bin/sdkmanager", args: ['tools', 'platform-tools', 'build-tools;25.0.2'], input: 'y' | |
+ proxy_host, proxy_port = (ENV["http_proxy"] || '').sub(/http:\/\//, '').sub(/\/$/, '').split(':') | |
+ proxy_args = [] | |
+ if proxy_host != "" then | |
+ proxy_args = ["--proxy=http", "--proxy_host=#{proxy_host}", "--proxy_port=#{(proxy_port || '80')}"] | |
+ end | |
+ system_command "#{staged_path}/tools/bin/sdkmanager", args: ['tools', 'platform-tools', 'build-tools;25.0.2'] + proxy_args, input: 'y' | |
end | |
caveats <<-EOS.undent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment