From 37222c195364e3e1c04ee8675a5f0470c2284713 Mon Sep 17 00:00:00 2001 From: Esther W Date: Thu, 18 May 2017 13:08:19 -0700 Subject: [PATCH 1/3] Fix implicit conversion of nil into string error --- Library/Homebrew/cask/lib/hbc/cli.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/lib/hbc/cli.rb b/Library/Homebrew/cask/lib/hbc/cli.rb index 37784f4c3c..c8fe391717 100644 --- a/Library/Homebrew/cask/lib/hbc/cli.rb +++ b/Library/Homebrew/cask/lib/hbc/cli.rb @@ -113,7 +113,7 @@ module Hbc if command.respond_to?(:run) # usual case: built-in command verb command.run(*rest) - elsif require?(which("brewcask-#{command}.rb")) + elsif require?(which("brewcask-#{command}.rb").to_s) # external command as Ruby library on PATH, Homebrew-style elsif command.to_s.include?("/") && require?(command.to_s) # external command as Ruby library with literal path, useful From 4da2f24b0ee819475daae14a839d953777767e8c Mon Sep 17 00:00:00 2001 From: Esther W Date: Thu, 18 May 2017 13:41:36 -0700 Subject: [PATCH 2/3] Remove to_s method --- Library/Homebrew/brew.rb | 1 + Library/Homebrew/cask/lib/hbc/cli.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 9b2ff75f0c..03eeb8a187 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -21,6 +21,7 @@ if ARGV == %w[--version] || ARGV == %w[-v] end def require?(path) + path ||= "" require path rescue LoadError => e # we should raise on syntax errors but not if the file doesn't exist. diff --git a/Library/Homebrew/cask/lib/hbc/cli.rb b/Library/Homebrew/cask/lib/hbc/cli.rb index c8fe391717..37784f4c3c 100644 --- a/Library/Homebrew/cask/lib/hbc/cli.rb +++ b/Library/Homebrew/cask/lib/hbc/cli.rb @@ -113,7 +113,7 @@ module Hbc if command.respond_to?(:run) # usual case: built-in command verb command.run(*rest) - elsif require?(which("brewcask-#{command}.rb").to_s) + elsif require?(which("brewcask-#{command}.rb")) # external command as Ruby library on PATH, Homebrew-style elsif command.to_s.include?("/") && require?(command.to_s) # external command as Ruby library with literal path, useful From 6325fb88c5ea191d12c0cf7cd4fdd91f04a79a1e Mon Sep 17 00:00:00 2001 From: Esther W Date: Thu, 18 May 2017 15:43:54 -0700 Subject: [PATCH 3/3] Make behavior clearer by returning false --- Library/Homebrew/brew.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 03eeb8a187..f3e40fc143 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -21,7 +21,7 @@ if ARGV == %w[--version] || ARGV == %w[-v] end def require?(path) - 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.