mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	[rubygems/rubygems] Improve performance of Specification#missing_extensions?
90c1919f94This commit is contained in:
		
							parent
							
								
									ad92651d64
								
							
						
					
					
						commit
						d03d122ba1
					
				
					 4 changed files with 9 additions and 4 deletions
				
			
		|  | @ -59,7 +59,7 @@ module Gem | |||
|   # Path to specification files of default gems. | ||||
| 
 | ||||
|   def self.default_specifications_dir | ||||
|     File.join(Gem.default_dir, "specifications", "default") | ||||
|     @default_specifications_dir ||= File.join(Gem.default_dir, "specifications", "default") | ||||
|   end | ||||
| 
 | ||||
|   ## | ||||
|  |  | |||
|  | @ -1556,8 +1556,8 @@ class Gem::Specification < Gem::BasicSpecification | |||
|   # the gem.build_complete file is missing. | ||||
| 
 | ||||
|   def build_extensions # :nodoc: | ||||
|     return if default_gem? | ||||
|     return if extensions.empty? | ||||
|     return if default_gem? | ||||
|     return if File.exist? gem_build_complete_path | ||||
|     return if !File.writable?(base_dir) | ||||
|     return if !File.exist?(File.join(base_dir, 'extensions')) | ||||
|  | @ -2120,8 +2120,8 @@ class Gem::Specification < Gem::BasicSpecification | |||
|   # probably want to build_extensions | ||||
| 
 | ||||
|   def missing_extensions? | ||||
|     return false if default_gem? | ||||
|     return false if extensions.empty? | ||||
|     return false if default_gem? | ||||
|     return false if File.exist? gem_build_complete_path | ||||
| 
 | ||||
|     true | ||||
|  |  | |||
|  | @ -9,7 +9,10 @@ module Gem | |||
|     Gem.ruby = ENV["RUBY"] | ||||
|   end | ||||
| 
 | ||||
|   @default_dir = ENV["BUNDLER_GEM_DEFAULT_DIR"] if ENV["BUNDLER_GEM_DEFAULT_DIR"] | ||||
|   if ENV["BUNDLER_GEM_DEFAULT_DIR"] | ||||
|     @default_dir = ENV["BUNDLER_GEM_DEFAULT_DIR"] | ||||
|     @default_specifications_dir = nil | ||||
|   end | ||||
| 
 | ||||
|   if ENV["BUNDLER_SPEC_PLATFORM"] | ||||
|     class Platform | ||||
|  |  | |||
|  | @ -396,6 +396,7 @@ class Gem::TestCase < Test::Unit::TestCase | |||
| 
 | ||||
|     ENV['GEM_PRIVATE_KEY_PASSPHRASE'] = PRIVATE_KEY_PASSPHRASE | ||||
| 
 | ||||
|     Gem.instance_variable_set(:@default_specifications_dir, nil) | ||||
|     if Gem.java_platform? | ||||
|       @orig_default_gem_home = RbConfig::CONFIG['default_gem_home'] | ||||
|       RbConfig::CONFIG['default_gem_home'] = @gemhome | ||||
|  | @ -479,6 +480,7 @@ class Gem::TestCase < Test::Unit::TestCase | |||
| 
 | ||||
|     RbConfig::CONFIG['bindir'] = @orig_bindir | ||||
| 
 | ||||
|     Gem.instance_variable_set :@default_specifications_dir, nil | ||||
|     if Gem.java_platform? | ||||
|       RbConfig::CONFIG['default_gem_home'] = @orig_default_gem_home | ||||
|     else | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Masataka Pocke Kuwabara
						Masataka Pocke Kuwabara