Use Homebrew’s require?.
This commit is contained in:
parent
d37f2e7ae7
commit
b032963d09
@ -91,17 +91,6 @@ module Hbc
|
|||||||
@lookup.fetch(command_string, command_string)
|
@lookup.fetch(command_string, command_string)
|
||||||
end
|
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)
|
def self.should_init?(command)
|
||||||
(command.is_a? Class) && (command < CLI::Base) && command.needs_init?
|
(command.is_a? Class) && (command < CLI::Base) && command.needs_init?
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user