lib/bundler/source/rubygems.rb in bundler-2.5.13 vs lib/bundler/source/rubygems.rb in bundler-2.5.14

- old
+ new

@@ -8,23 +8,24 @@ autoload :Remote, File.expand_path("rubygems/remote", __dir__) # Ask for X gems per API request API_REQUEST_SIZE = 50 - attr_reader :remotes + attr_accessor :remotes def initialize(options = {}) @options = options @remotes = [] @dependency_names = [] @allow_remote = false @allow_cached = false @allow_local = options["allow_local"] || false @checksum_store = Checksum::Store.new - @original_remotes = nil Array(options["remotes"]).reverse_each {|r| add_remote(r) } + + @lockfile_remotes = @remotes if options["from_lockfile"] end def caches @caches ||= [cache_path, *Bundler.rubygems.gem_cache] end @@ -90,18 +91,13 @@ { "remotes" => @remotes.map(&:to_s) } end def self.from_lock(options) options["remotes"] = Array(options.delete("remote")).reverse - new(options) + new(options.merge("from_lockfile" => true)) end - def remotes=(new_remotes) - @original_remotes = @remotes - @remotes = new_remotes - end - def to_lock out = String.new("GEM\n") lockfile_remotes.reverse_each do |remote| out << " remote: #{remote}\n" end @@ -468,10 +464,10 @@ end private def lockfile_remotes - @original_remotes || credless_remotes + @lockfile_remotes || credless_remotes end # Checks if the requested spec exists in the global cache. If it does, # we copy it to the download path, and if it does not, we download it. #