From 599a618273a64db1852f4bb80e21ee0c410a3285 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Wed, 14 Jun 2017 12:51:36 +0200 Subject: [PATCH] Move `require?` to `utils`. --- Library/Homebrew/brew.rb | 8 -------- Library/Homebrew/utils.rb | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 4a72c7e552..11ea8df672 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/utils.rb b/Library/Homebrew/utils.rb index 85305c01ae..529f3492d1 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)