Merge pull request #2277 from reitermarkus/require

Use Homebrew’s `require?`.
This commit is contained in:
Markus Reiter 2017-03-07 00:29:04 +01:00 committed by GitHub
commit 067c71363d

View File

@ -91,17 +91,6 @@ module Hbc
@lookup.fetch(command_string, command_string)
end
# modified from Homebrew
def self.require?(path)
require path
true # OK if already loaded
rescue LoadError => e
# HACK: :( because we should raise on syntax errors
# but not if the file doesn't exist.
# TODO: make robust!
raise unless e.to_s.include? path
end
def self.should_init?(command)
(command.is_a? Class) && (command < CLI::Base) && command.needs_init?
end