Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/bundler/definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,9 @@ def additional_base_requirements_for_resolve
dependencies_by_name = dependencies.inject({}) {|memo, dep| memo.update(dep.name => dep) }
@locked_gems.specs.reduce({}) do |requirements, locked_spec|
name = locked_spec.name
next requirements if @locked_gems.dependencies[name] != dependencies_by_name[name]
dependency = dependencies_by_name[name]
next requirements if @locked_gems.dependencies[name] != dependency
next requirements if dependency && dependency.source.is_a?(Source::Path)
Comment thread
greysteil marked this conversation as resolved.
dep = Gem::Dependency.new(name, ">= #{locked_spec.version}")
requirements[name] = DepProxy.new(dep, locked_spec.platform)
requirements
Expand Down
14 changes: 14 additions & 0 deletions spec/install/gemfile/gemspec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,20 @@
expect(out).to eq("WIN")
end

it "works with only_update_to_newer_versions" do
build_lib "omg", "2.0", :path => lib_path("omg")

install_gemfile <<-G
gemspec :path => "#{lib_path("omg")}"
G

build_lib "omg", "1.0", :path => lib_path("omg")

bundle! :install, :env => { "BUNDLE_BUNDLE_ONLY_UPDATE_TO_NEWER_VERSIONS" => "true" }

expect(the_bundle).to include_gems "omg 1.0"
end

context "in deployment mode" do
context "when the lockfile was not updated after a change to the gemspec's dependencies" do
it "reports that installation failed" do
Expand Down
14 changes: 14 additions & 0 deletions spec/install/gemfile/path_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,20 @@
expect(the_bundle).to include_gems "foo 1.0"
end

it "works with only_update_to_newer_versions" do
build_lib "omg", "2.0", :path => lib_path("omg")

install_gemfile <<-G
gem "omg", :path => "#{lib_path("omg")}"
G

build_lib "omg", "1.0", :path => lib_path("omg")

bundle! :install, :env => { "BUNDLE_BUNDLE_ONLY_UPDATE_TO_NEWER_VERSIONS" => "true" }

expect(the_bundle).to include_gems "omg 1.0"
end

it "prefers gemspecs closer to the path root" do
build_lib "premailer", "1.0.0", :path => lib_path("premailer") do |s|
s.write "gemfiles/ruby187.gemspec", <<-G
Expand Down