diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb index cb131a0185fa0f..dadac408b77d63 100644 --- a/lib/bundler/rubygems_ext.rb +++ b/lib/bundler/rubygems_ext.rb @@ -351,9 +351,8 @@ class Specification end def extensions_dir - Gem.default_ext_dir_for(base_dir) || - File.join(base_dir, "extensions", ORIGINAL_LOCAL_PLATFORM, - Gem.extension_api_version) + @extensions_dir ||= + Gem.default_ext_dir_for(base_dir) || File.join(base_dir, "extensions", ORIGINAL_LOCAL_PLATFORM, Gem.extension_api_version) end end end diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index 6f69ee22cecbc0..31ef29f02f876b 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -530,13 +530,6 @@ def require_paths=(val) attr_reader :required_rubygems_version - ## - # The version of RubyGems used to create this gem. - # - # Do not set this, it is set automatically when the gem is packaged. - - attr_accessor :rubygems_version - ## # The key used to sign this gem. See Gem::Security for details. @@ -724,6 +717,21 @@ def test_files=(files) # :nodoc: @test_files = Array files end + ###################################################################### + # :section: Read-only attributes + + ## + # The version of RubyGems used to create this gem. + + attr_accessor :rubygems_version + + ## + # The path where this gem installs its extensions. + + def extensions_dir + @extensions_dir ||= super + end + ###################################################################### # :section: Specification internals