diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb index cb131a0185..dadac408b7 100644 --- a/lib/bundler/rubygems_ext.rb +++ b/lib/bundler/rubygems_ext.rb @@ -351,9 +351,8 @@ module Gem 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 6f69ee22ce..31ef29f02f 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -530,13 +530,6 @@ class Gem::Specification < Gem::BasicSpecification 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 @@ class Gem::Specification < Gem::BasicSpecification @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