Skip to content

Commit

Permalink
only require binding_of_caller if the right version is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
Charlie Somerville committed Sep 8, 2013
1 parent eae00b1 commit b8836ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ext/mkrf_conf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions lib/better_errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit b8836ad

Please sign in to comment.