зеркало из https://github.com/github/ruby.git
[rubygems/rubygems] Improve source gemfile/lockfile equivalence checks
Since we no longer have multiple global sources, each top level dependency is always pinned to a single source, so it makes little sense to talk about adding or removing a source. Instead, source changes always mean to change the source one or more dependencies are pinned to. This logic can now be much simpler. https://github.com/rubygems/rubygems/commit/f1d33fa0df
This commit is contained in:
Родитель
248fae0ec4
Коммит
4c5e862434
|
@ -371,35 +371,25 @@ module Bundler
|
|||
added.concat new_platforms.map {|p| "* platform: #{p}" }
|
||||
deleted.concat deleted_platforms.map {|p| "* platform: #{p}" }
|
||||
|
||||
gemfile_sources = sources.lock_sources
|
||||
|
||||
new_sources = gemfile_sources - @locked_sources
|
||||
deleted_sources = @locked_sources - gemfile_sources
|
||||
|
||||
new_deps = @dependencies - locked_dependencies
|
||||
deleted_deps = locked_dependencies - @dependencies
|
||||
|
||||
if @locked_sources != gemfile_sources
|
||||
if new_sources.any?
|
||||
added.concat new_sources.map {|source| "* source: #{source}" }
|
||||
end
|
||||
|
||||
if deleted_sources.any?
|
||||
deleted.concat deleted_sources.map {|source| "* source: #{source}" }
|
||||
end
|
||||
end
|
||||
|
||||
added.concat new_deps.map {|d| "* #{pretty_dep(d)}" } if new_deps.any?
|
||||
deleted.concat deleted_deps.map {|d| "* #{pretty_dep(d)}" } if deleted_deps.any?
|
||||
|
||||
both_sources = Hash.new {|h, k| h[k] = [] }
|
||||
@dependencies.each {|d| both_sources[d.name][0] = d }
|
||||
locked_dependencies.each {|d| both_sources[d.name][1] = d.source }
|
||||
locked_dependencies.each {|d| both_sources[d.name][1] = d }
|
||||
|
||||
both_sources.each do |name, (dep, lock_source)|
|
||||
next if lock_source.nil? || lock_source.can_lock?(dep)
|
||||
gemfile_source_name = dep.source || "no specified source"
|
||||
lockfile_source_name = lock_source
|
||||
both_sources.each do |name, (dep, lock_dep)|
|
||||
next if dep.nil? || lock_dep.nil?
|
||||
|
||||
gemfile_source = dep.source || sources.default_source
|
||||
lock_source = lock_dep.source || sources.default_source
|
||||
next if lock_source.include?(gemfile_source)
|
||||
|
||||
gemfile_source_name = dep.source ? gemfile_source.identifier : "no specified source"
|
||||
lockfile_source_name = lock_dep.source ? lock_source.identifier : "no specified source"
|
||||
changed << "* #{name} from `#{lockfile_source_name}` to `#{gemfile_source_name}`"
|
||||
end
|
||||
|
||||
|
|
|
@ -357,11 +357,11 @@ RSpec.describe "install in deployment or frozen mode" do
|
|||
bundle "config set --local deployment true"
|
||||
bundle :install, :raise_on_error => false
|
||||
expect(err).to include("deployment mode")
|
||||
expect(err).to include("You have added to the Gemfile:\n* source: git://hubz.com")
|
||||
expect(err).not_to include("You have changed in the Gemfile")
|
||||
expect(err).not_to include("You have added to the Gemfile")
|
||||
expect(err).to include("You have changed in the Gemfile:\n* rack from `no specified source` to `git://hubz.com`")
|
||||
end
|
||||
|
||||
it "explodes if you unpin a source" do
|
||||
it "explodes if you change a source" do
|
||||
build_git "rack"
|
||||
|
||||
install_gemfile <<-G
|
||||
|
@ -377,12 +377,12 @@ RSpec.describe "install in deployment or frozen mode" do
|
|||
bundle "config set --local deployment true"
|
||||
bundle :install, :raise_on_error => false
|
||||
expect(err).to include("deployment mode")
|
||||
expect(err).to include("You have deleted from the Gemfile:\n* source: #{lib_path("rack-1.0")}")
|
||||
expect(err).not_to include("You have deleted from the Gemfile")
|
||||
expect(err).not_to include("You have added to the Gemfile")
|
||||
expect(err).to include("You have changed in the Gemfile:\n* rack from `#{lib_path("rack-1.0")}` to `no specified source`")
|
||||
end
|
||||
|
||||
it "explodes if you unpin a source, leaving it pinned somewhere else" do
|
||||
it "explodes if you change a source" do
|
||||
build_lib "foo", :path => lib_path("rack/foo")
|
||||
build_git "rack", :path => lib_path("rack")
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче