diff --git a/ext/mkrf_conf.rb b/ext/mkrf_conf.rb index 50adfca2..86f66a9d 100644 --- a/ext/mkrf_conf.rb +++ b/ext/mkrf_conf.rb @@ -3,6 +3,8 @@ gem = Gem::DependencyInstaller.new if ["rbx", "ruby"].include?(RUBY_ENGINE) + # This MUST match the version specified in lib/better_errors.rb, or else + # weird shit will happen. if Gem::Dependency.new("binding_of_caller", "0.7.2").matching_specs.empty? gem.install "binding_of_caller", "0.7.2" end diff --git a/lib/better_errors.rb b/lib/better_errors.rb index 8f3a9b20..7347edc0 100644 --- a/lib/better_errors.rb +++ b/lib/better_errors.rb @@ -134,10 +134,11 @@ def self.default_editor BetterErrors.editor = default_editor end -begin +if Gem::Dependency.new("binding_of_caller", "0.7.2").matching_specs.any? + gem "binding_of_caller", "0.7.2" require "binding_of_caller" BetterErrors.binding_of_caller_available = true -rescue LoadError => e +else BetterErrors.binding_of_caller_available = false end