aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2017-02-05 12:13:45 +0100
committerGitHub2017-02-05 12:13:45 +0100
commitda9dd0a8633d826caac89bc0c6230caf542135b1 (patch)
tree711ea116cc154606bcccac7b5f7ce52d0d386d69
parent33fa80944ebff6b609e67712fb87ccc394cb327b (diff)
parent6594650eb1c37170e7d70e7e9c75b48d154e38a9 (diff)
downloadbrew-da9dd0a8633d826caac89bc0c6230caf542135b1.tar.bz2
Merge pull request #1951 from tma/reinstall-with-options
Print warning when reinstalling with invalid options
-rw-r--r--Library/Homebrew/cmd/reinstall.rb20
-rw-r--r--Library/Homebrew/test/reinstall_test.rb9
2 files changed, 20 insertions, 9 deletions
diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb
index 2eb2840a5..586405909 100644
--- a/Library/Homebrew/cmd/reinstall.rb
+++ b/Library/Homebrew/cmd/reinstall.rb
@@ -25,19 +25,21 @@ module Homebrew
backup keg
end
- options = BuildOptions.new(Options.create(ARGV.flags_only), f.options).used_options
+ build_options = BuildOptions.new(Options.create(ARGV.flags_only), f.options)
+ options = build_options.used_options
options |= f.build.used_options
options &= f.options
fi = FormulaInstaller.new(f)
- fi.options = options
- fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && f.build.build_bottle?)
- fi.build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source?
- fi.force_bottle = ARGV.force_bottle?
- fi.interactive = ARGV.interactive?
- fi.git = ARGV.git?
- fi.verbose = ARGV.verbose?
- fi.debug = ARGV.debug?
+ fi.options = options
+ fi.invalid_option_names = build_options.invalid_option_names
+ fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && f.build.build_bottle?)
+ fi.build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source?
+ fi.force_bottle = ARGV.force_bottle?
+ fi.interactive = ARGV.interactive?
+ fi.git = ARGV.git?
+ fi.verbose = ARGV.verbose?
+ fi.debug = ARGV.debug?
fi.prelude
oh1 "Reinstalling #{f.full_name} #{options.to_a.join " "}"
diff --git a/Library/Homebrew/test/reinstall_test.rb b/Library/Homebrew/test/reinstall_test.rb
index 613c06188..2906983c3 100644
--- a/Library/Homebrew/test/reinstall_test.rb
+++ b/Library/Homebrew/test/reinstall_test.rb
@@ -12,4 +12,13 @@ class IntegrationCommandTestReinstall < IntegrationCommandTestCase
cmd("reinstall", "testball")
assert foo_dir.exist?
end
+
+ def test_reinstall_with_invalid_option
+ setup_test_formula "testball"
+
+ cmd("install", "testball", "--with-foo")
+
+ assert_match "testball: this formula has no --with-fo option so it will be ignored!",
+ cmd("reinstall", "testball", "--with-fo")
+ end
end