diff options
| -rw-r--r-- | .github/ISSUE_TEMPLATE.md | 14 | ||||
| -rw-r--r-- | Library/Homebrew/diagnostic.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/download_strategy.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/manpages/brew.1.md.erb | 3 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/dsl_spec.rb | 1 | ||||
| -rw-r--r-- | Library/Homebrew/test/download_strategies_spec.rb | 13 | ||||
| -rw-r--r-- | Library/Homebrew/test/utils/tty_spec.rb | 14 | ||||
| -rw-r--r-- | Library/Homebrew/utils/tty.rb | 4 | ||||
| -rwxr-xr-x | bin/brew | 6 | ||||
| -rw-r--r-- | docs/Manpage.md | 3 | ||||
| -rw-r--r-- | manpages/brew.1 | 4 |
11 files changed, 57 insertions, 15 deletions
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 287e95b03..cfa55d26e 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,10 +1,10 @@ **Please note we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.** -# Please always follow these steps: -- [ ] Confirmed this is a problem with running a `brew` command and not `brew install`ing or the post-install behaviour of one or more formulae? If it's a formulae-specific problem please file this issue at the relevant tap e.g. for Homebrew/homebrew-core https://github.com/Homebrew/homebrew-core/issues/new -- [ ] Ran `brew update` and retried your prior step? -- [ ] Ran `brew doctor`, fixed all issues and retried your prior step? -- [ ] Ran `brew config` and `brew doctor` and included their output with your issue? +- [ ] are reporting a bug others will be able to reproduce and not asking a question. If you're not sure or want to ask a question do so on our Discourse: https://discourse.brew.sh +- [ ] ran a `brew` command and reproduced the problem with multiple formulae? If it's a problem with a single, official formula (not cask) please file this issue at Homebrew/homebrew-core: https://github.com/Homebrew/homebrew-core/issues/new. If it's a `brew cask` problem please file this issue at https://github.com/caskroom/homebrew-cask/issues/new. If it's a tap (e.g. Homebrew/homebrew-php) problem please file this issue at the tap. +- [ ] ran `brew update` and can still reproduce the problem? +- [ ] ran `brew doctor`, fixed all issues and can still reproduce the problem? +- [ ] ran `brew config` and `brew doctor` and included their output with your issue? To help us debug your issue please explain: - What you were trying to do (and why) @@ -16,7 +16,7 @@ To help us debug your issue please explain: Please replace this section with: - a detailed description of your proposed feature - the motivation for the feature -- how the feature would be relevant to at least 90% of Homebrew users +- how the feature would be relevant to at least 90% of Homebrew users (if it's not: do not open a feature request) - what alternatives to the feature you have considered -We will close this issue or ask you to create a pull-request if it's something we're not actively planning to work on. +We will close this issue or ask you to create a pull-request if it's something the maintainers are not actively planning to work on. diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 8516f2b63..178758347 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -788,7 +788,7 @@ module Homebrew EOS end - return if ENV["CI"] || ENV["JENKINS_HOME"] + return if ENV["CI"] branch = coretap_path.git_branch return if branch.nil? || branch =~ /master/ @@ -838,7 +838,7 @@ module Homebrew def check_for_large_cache return unless HOMEBREW_CACHE.exist? # CI can be expected to have a large cache. - return if ENV["CI"] || ENV["JENKINS_HOME"] + return if ENV["CI"] cache_size = HOMEBREW_CACHE.disk_usage return unless cache_size > 2_147_483_648 <<~EOS diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index feb518057..e85661d76 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -303,7 +303,11 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy # We can't use basename_without_params, because given a URL like # https://example.com/download.php?file=foo-1.0.tar.gz # the extension we want is ".tar.gz", not ".php". - Pathname.new(@url).extname[/[^?]+/] + Pathname.new(@url).ascend do |path| + ext = path.extname[/[^?]+/] + return ext if ext + end + nil end end diff --git a/Library/Homebrew/manpages/brew.1.md.erb b/Library/Homebrew/manpages/brew.1.md.erb index 508c90f2d..fbe6fca94 100644 --- a/Library/Homebrew/manpages/brew.1.md.erb +++ b/Library/Homebrew/manpages/brew.1.md.erb @@ -199,6 +199,9 @@ can take several different forms: If set, Homebrew will not auto-update before running `brew install`, `brew upgrade` or `brew tap`. + * `HOMEBREW_NO_COLOR`: + If set, Homebrew will not print text with color added. + * `HOMEBREW_NO_EMOJI`: If set, Homebrew will not print the `HOMEBREW_INSTALL_BADGE` on a successful build. diff --git a/Library/Homebrew/test/cask/dsl_spec.rb b/Library/Homebrew/test/cask/dsl_spec.rb index d3bb46264..993c03bac 100644 --- a/Library/Homebrew/test/cask/dsl_spec.rb +++ b/Library/Homebrew/test/cask/dsl_spec.rb @@ -75,6 +75,7 @@ describe Hbc::DSL, :cask do it "may use deprecated DSL version hash syntax" do allow(ENV).to receive(:[]).with("HOMEBREW_DEVELOPER").and_return(nil) + allow(ENV).to receive(:[]).with("HOMEBREW_NO_COLOR").and_return(nil) expect(cask.token).to eq("with-dsl-version") expect(cask.url.to_s).to eq("http://example.com/TestCask.dmg") diff --git a/Library/Homebrew/test/download_strategies_spec.rb b/Library/Homebrew/test/download_strategies_spec.rb index 06d6fa855..7ad070fc4 100644 --- a/Library/Homebrew/test/download_strategies_spec.rb +++ b/Library/Homebrew/test/download_strategies_spec.rb @@ -209,6 +209,19 @@ describe CurlDownloadStrategy do it "parses the opts and sets the corresponding args" do expect(subject.send(:_curl_opts)).to eq(["--user", "download:123456"]) end + + describe "#tarball_path" do + subject { described_class.new(name, resource).tarball_path } + + context "when URL ends with file" do + it { is_expected.to eq(HOMEBREW_CACHE/"foo-.tar.gz") } + end + + context "when URL file is in middle" do + let(:url) { "http://example.com/foo.tar.gz/from/this/mirror" } + it { is_expected.to eq(HOMEBREW_CACHE/"foo-.tar.gz") } + end + end end describe DownloadStrategyDetector do diff --git a/Library/Homebrew/test/utils/tty_spec.rb b/Library/Homebrew/test/utils/tty_spec.rb index 3ba89b6fd..e6c9168f3 100644 --- a/Library/Homebrew/test/utils/tty_spec.rb +++ b/Library/Homebrew/test/utils/tty_spec.rb @@ -53,7 +53,7 @@ describe Tty do allow($stdout).to receive(:tty?).and_return(true) end - it "returns an empty string for all colors" do + it "returns ANSI escape codes for colors" do expect(subject.to_s).to eq("") expect(subject.red.to_s).to eq("\033[31m") expect(subject.green.to_s).to eq("\033[32m") @@ -63,5 +63,17 @@ describe Tty do expect(subject.cyan.to_s).to eq("\033[36m") expect(subject.default.to_s).to eq("\033[39m") end + + it "returns an empty string for all colors when HOMEBREW_NO_COLOR is set" do + ENV["HOMEBREW_NO_COLOR"] = "1" + expect(subject.to_s).to eq("") + expect(subject.red.to_s).to eq("") + expect(subject.green.to_s).to eq("") + expect(subject.yellow.to_s).to eq("") + expect(subject.blue.to_s).to eq("") + expect(subject.magenta.to_s).to eq("") + expect(subject.cyan.to_s).to eq("") + expect(subject.default.to_s).to eq("") + end end end diff --git a/Library/Homebrew/utils/tty.rb b/Library/Homebrew/utils/tty.rb index e872e6460..81d5f00d7 100644 --- a/Library/Homebrew/utils/tty.rb +++ b/Library/Homebrew/utils/tty.rb @@ -59,7 +59,9 @@ module Tty end def to_s - return "" unless $stdout.tty? + if ENV["HOMEBREW_NO_COLOR"] || !$stdout.tty? + return "" + end current_escape_sequence ensure reset_escape_sequence! @@ -47,7 +47,7 @@ HOMEBREW_LIBRARY="$HOMEBREW_REPOSITORY/Library" # Whitelist and copy to HOMEBREW_* all variables previously mentioned in # manpage or used elsewhere by Homebrew. for VAR in AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY BINTRAY_USER BINTRAY_KEY \ - BROWSER EDITOR GIT PATH VISUAL \ + BROWSER EDITOR GIT NO_COLOR PATH VISUAL \ GITHUB_USER GITHUB_PASSWORD GITHUB_TOKEN do # Skip if variable value is empty. @@ -66,9 +66,9 @@ then FILTERED_ENV=() # Filter all but the specific variables. - for VAR in HOME SHELL PATH TERM LOGNAME USER CI TRAVIS SSH_AUTH_SOCK SUDO_ASKPASS \ + for VAR in HOME SHELL PATH TERM LOGNAME USER CI TRAVIS TRAVIS_SUDO SSH_AUTH_SOCK SUDO_ASKPASS \ http_proxy https_proxy ftp_proxy no_proxy all_proxy HTTPS_PROXY FTP_PROXY ALL_PROXY \ - "${!HOMEBREW_@}" "${!TRAVIS_@}" "${!JENKINS_@}" + "${!HOMEBREW_@}" do # Skip if variable value is empty. [[ -z "${!VAR}" ]] && continue diff --git a/docs/Manpage.md b/docs/Manpage.md index 920518376..e4f189490 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1037,6 +1037,9 @@ can take several different forms: If set, Homebrew will not auto-update before running `brew install`, `brew upgrade` or `brew tap`. + * `HOMEBREW_NO_COLOR`: + If set, Homebrew will not print text with color added. + * `HOMEBREW_NO_EMOJI`: If set, Homebrew will not print the `HOMEBREW_INSTALL_BADGE` on a successful build. diff --git a/manpages/brew.1 b/manpages/brew.1 index 56581bfc0..4f373558c 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1059,6 +1059,10 @@ If set, Homebrew will not send analytics\. See: \fIhttps://docs\.brew\.sh/Analyt If set, Homebrew will not auto\-update before running \fBbrew install\fR, \fBbrew upgrade\fR or \fBbrew tap\fR\. . .TP +\fBHOMEBREW_NO_COLOR\fR +If set, Homebrew will not print text with color added\. +. +.TP \fBHOMEBREW_NO_EMOJI\fR If set, Homebrew will not print the \fBHOMEBREW_INSTALL_BADGE\fR on a successful build\. . |
