lib/bundler/source/rubygems.rb in bundler-2.5.18 vs lib/bundler/source/rubygems.rb in bundler-2.5.19

- old
+ new

@@ -146,11 +146,11 @@ index end end def install(spec, options = {}) - if (spec.default_gem? && !cached_built_in_gem(spec)) || (installed?(spec) && !options[:force]) + if (spec.default_gem? && !cached_built_in_gem(spec, local: options[:local])) || (installed?(spec) && !options[:force]) print_using_message "Using #{version_message(spec, options[:previous_spec])}" return nil # no post-install message end if spec.remote @@ -220,16 +220,17 @@ rescue Errno::EACCES => e Bundler.ui.debug(e) raise InstallError, e.message end - def cached_built_in_gem(spec) - cached_path = cached_path(spec) - if cached_path.nil? + def cached_built_in_gem(spec, local: false) + cached_path = cached_gem(spec) + if cached_path.nil? && !local remote_spec = remote_specs.search(spec).first if remote_spec cached_path = fetch_gem(remote_spec) + spec.remote = remote_spec.remote else Bundler.ui.warn "#{spec.full_name} is built in to Ruby, and can't be cached because your Gemfile doesn't have any sources that contain it." end end cached_path @@ -322,17 +323,9 @@ uris end end def cached_gem(spec) - if spec.default_gem? - cached_built_in_gem(spec) - else - cached_path(spec) - end - end - - def cached_path(spec) global_cache_path = download_cache_path(spec) caches << global_cache_path if global_cache_path possibilities = caches.map {|p| package_path(p, spec) } possibilities.find {|p| File.exist?(p) }