diff options
| author | Markus Reiter | 2017-06-14 14:26:44 +0200 |
|---|---|---|
| committer | GitHub | 2017-06-14 14:26:44 +0200 |
| commit | 3fe32053a7f0d7f817a90e308ab0c62436a5c208 (patch) | |
| tree | db82470e49d238ca77f11e838939b90895d691d4 | |
| parent | bfcb3928f86ea7e4b9274d9f85a502a3b38ac2d4 (diff) | |
| parent | dcb85571ca468a573c5ac4f76752ec7e732d9e82 (diff) | |
| download | brew-3fe32053a7f0d7f817a90e308ab0c62436a5c208.tar.bz2 | |
Merge pull request #2775 from reitermarkus/language
Fix `--language` option.
| -rw-r--r-- | Library/Homebrew/brew.rb | 8 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/cli_spec.rb | 21 | ||||
| -rw-r--r-- | Library/Homebrew/utils.rb | 8 |
4 files changed, 23 insertions, 16 deletions
diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 4a72c7e55..11ea8df67 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -21,14 +21,6 @@ if ARGV == %w[--version] || ARGV == %w[-v] exit 0 end -def require?(path) - return false if path.nil? - require path -rescue LoadError => e - # we should raise on syntax errors but not if the file doesn't exist. - raise unless e.message.include?(path) -end - begin trap("INT", std_trap) # restore default CTRL-C handler diff --git a/Library/Homebrew/cask/lib/hbc/cli.rb b/Library/Homebrew/cask/lib/hbc/cli.rb index 04a414904..0108c1621 100644 --- a/Library/Homebrew/cask/lib/hbc/cli.rb +++ b/Library/Homebrew/cask/lib/hbc/cli.rb @@ -66,7 +66,7 @@ module Hbc option "--help", :help, false # handled in OS::Mac - option "--language a,b,c", ->(*) { raise OptionParser::InvalidOption } + option "--language a,b,c", ->(*) {} # override default handling of --version option "--version", ->(*) { raise OptionParser::InvalidOption } diff --git a/Library/Homebrew/test/cask/cli_spec.rb b/Library/Homebrew/test/cask/cli_spec.rb index caa17b031..51258c580 100644 --- a/Library/Homebrew/test/cask/cli_spec.rb +++ b/Library/Homebrew/test/cask/cli_spec.rb @@ -1,10 +1,10 @@ describe Hbc::CLI, :cask do it "lists the taps for Casks that show up in two taps" do - listing = Hbc::CLI.nice_listing(%w[ - caskroom/cask/adium - caskroom/cask/google-chrome - passcod/homebrew-cask/adium - ]) + listing = described_class.nice_listing(%w[ + caskroom/cask/adium + caskroom/cask/google-chrome + passcod/homebrew-cask/adium + ]) expect(listing).to eq(%w[ caskroom/cask/adium @@ -13,6 +13,13 @@ describe Hbc::CLI, :cask do ]) end + it "ignores the `--language` option, which is handled in `OS::Mac`" do + cli = described_class.new("--language=en") + expect(cli).to receive(:detect_command_and_arguments).with(no_args) + expect(cli).to receive(:exit).with(1) + shutup { cli.run } + end + context "when no option is specified" do it "--binaries is true by default" do command = Hbc::CLI::Install.new("some-cask") @@ -41,7 +48,7 @@ describe Hbc::CLI, :cask do end it "prints help output when subcommand receives `--help` flag" do - command = Hbc::CLI.new("noop", "--help") + command = described_class.new("noop", "--help") expect(described_class).to receive(:run_command).with("help", "noop") command.run expect(command.help?).to eq(true) @@ -56,7 +63,7 @@ describe Hbc::CLI, :cask do it "exits with a status of 1 when something goes wrong" do allow(described_class).to receive(:lookup_command).and_raise(Hbc::CaskError) - command = Hbc::CLI.new("noop") + command = described_class.new("noop") expect(command).to receive(:exit).with(1) command.run end diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 85305c01a..529f3492d 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -15,6 +15,14 @@ require "utils/svn" require "utils/tty" require "time" +def require?(path) + return false if path.nil? + require path +rescue LoadError => e + # we should raise on syntax errors but not if the file doesn't exist. + raise unless e.message.include?(path) +end + def ohai(title, *sput) title = Tty.truncate(title) if $stdout.tty? && !ARGV.verbose? puts Formatter.headline(title, color: :blue) |
