aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/style.rb11
-rw-r--r--Library/Homebrew/exceptions.rb9
-rw-r--r--Library/Homebrew/formula_installer.rb4
-rw-r--r--Library/Homebrew/requirements/xcode_requirement.rb7
-rw-r--r--Library/Homebrew/test/cask/cli/style_spec.rb7
5 files changed, 28 insertions, 10 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/style.rb b/Library/Homebrew/cask/lib/hbc/cli/style.rb
index 86fc98eaa..261bed50b 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/style.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/style.rb
@@ -10,9 +10,9 @@ module Hbc
def run
install_rubocop
cache_env = { "XDG_CACHE_HOME" => "#{HOMEBREW_CACHE}/style" }
- system(cache_env, "rubocop", *rubocop_args, "--", *cask_paths)
+ hide_warnings = debug? ? [] : [ENV["HOMEBREW_RUBY_PATH"], "-W0", "-S"]
+ system(cache_env, *hide_warnings, "rubocop", *rubocop_args, "--", *cask_paths)
raise CaskError, "style check failed" unless $CHILD_STATUS.success?
- true
end
def install_rubocop
@@ -36,18 +36,21 @@ module Hbc
end
def rubocop_args
- fix? ? autocorrect_args : default_args
+ fix? ? autocorrect_args : normal_args
end
def default_args
[
"--require", "rubocop-cask",
"--force-default-config",
- "--force-exclusion",
"--format", "simple"
]
end
+ def normal_args
+ default_args + ["--parallel"]
+ end
+
def autocorrect_args
default_args + ["--auto-correct"]
end
diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb
index 7705f9d49..42c62338a 100644
--- a/Library/Homebrew/exceptions.rb
+++ b/Library/Homebrew/exceptions.rb
@@ -458,7 +458,7 @@ end
# if the user passes any flags/environment that would case a bottle-only
# installation on a system without build tools to fail
class BuildFlagsError < RuntimeError
- def initialize(flags)
+ def initialize(flags, bottled: true)
if flags.length > 1
flag_text = "flags"
require_text = "require"
@@ -467,13 +467,18 @@ class BuildFlagsError < RuntimeError
require_text = "requires"
end
- super <<~EOS
+ message = <<~EOS.chomp!
The following #{flag_text}:
#{flags.join(", ")}
#{require_text} building tools, but none are installed.
#{DevelopmentTools.installation_instructions}
+ EOS
+
+ message << <<~EOS.chomp! if bottled
Alternatively, remove the #{flag_text} to attempt bottle installation.
EOS
+
+ super message
end
end
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 2105b9d71..a89da9ae9 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -70,8 +70,10 @@ class FormulaInstaller
# can proceed. Only invoked when the user has no developer tools.
def self.prevent_build_flags
build_flags = ARGV.collect_build_flags
+ return if build_flags.empty?
- raise BuildFlagsError, build_flags unless build_flags.empty?
+ all_bottled = ARGV.formulae.all?(&:bottled?)
+ raise BuildFlagsError.new(build_flags, bottled: all_bottled)
end
def build_bottle?
diff --git a/Library/Homebrew/requirements/xcode_requirement.rb b/Library/Homebrew/requirements/xcode_requirement.rb
index a5f078c62..9396b0df7 100644
--- a/Library/Homebrew/requirements/xcode_requirement.rb
+++ b/Library/Homebrew/requirements/xcode_requirement.rb
@@ -22,7 +22,12 @@ class XcodeRequirement < Requirement
A full installation of Xcode.app#{version} is required to compile this software.
Installing just the Command Line Tools is not sufficient.
EOS
- if MacOS.version >= :lion
+ if Version.new(MacOS::Xcode.latest_version) < Version.new(@version)
+ message + <<~EOS
+ Xcode#{version} cannot be installed on macOS #{MacOS.version}.
+ You must upgrade your version of macOS.
+ EOS
+ elsif MacOS.version >= :lion
message + <<~EOS
Xcode can be installed from the App Store.
EOS
diff --git a/Library/Homebrew/test/cask/cli/style_spec.rb b/Library/Homebrew/test/cask/cli/style_spec.rb
index 12cd348a0..850f04f8d 100644
--- a/Library/Homebrew/test/cask/cli/style_spec.rb
+++ b/Library/Homebrew/test/cask/cli/style_spec.rb
@@ -22,7 +22,10 @@ describe Hbc::CLI::Style, :cask do
context "when rubocop succeeds" do
let(:success) { true }
- it { is_expected.to be_truthy }
+
+ it "does not raise an error" do
+ expect { subject }.not_to raise_error
+ end
end
context "when rubocop fails" do
@@ -132,7 +135,7 @@ describe Hbc::CLI::Style, :cask do
describe "#default_args" do
subject { cli.default_args }
- it { is_expected.to include("--require", "rubocop-cask", "--format", "simple", "--force-exclusion") }
+ it { is_expected.to include("--require", "rubocop-cask", "--format", "simple") }
end
describe "#autocorrect_args" do