diff options
Diffstat (limited to 'lib/bundler/stub_specification.rb')
-rw-r--r-- | lib/bundler/stub_specification.rb | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/bundler/stub_specification.rb b/lib/bundler/stub_specification.rb index c0a8d92252..7245860bbe 100644 --- a/lib/bundler/stub_specification.rb +++ b/lib/bundler/stub_specification.rb @@ -11,15 +11,17 @@ module Bundler attr_accessor :stub, :ignored - def source=(source) - super - # Stub has no concept of source, which means that extension_dir may be wrong - # This is the case for git-based gems. So, instead manually assign the extension dir - if source.respond_to?(:extension_dir_name) - path = File.join(stub.extensions_dir, source.extension_dir_name) - stub.extension_dir = File.expand_path(path) - else - stub.extension_dir = nil + # Pre 2.2.0 did not include extension_dir + # https://github.com/rubygems/rubygems/commit/9485ca2d101b82a946d6f327f4bdcdea6d4946ea + if Bundler.rubygems.provides?(">= 2.2.0") + def source=(source) + super + # Stub has no concept of source, which means that extension_dir may be wrong + # This is the case for git-based gems. So, instead manually assign the extension dir + if source.respond_to?(:extension_dir_name) + path = File.join(stub.extensions_dir, source.extension_dir_name) + stub.extension_dir = File.expand_path(path) + end end end |