summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2018-11-05 22:33:28 -0800
committerSamuel Giddins <segiddins@segiddins.me>2018-11-17 15:31:01 -0600
commitfdb3a609adca1acfc9e1d0ed178cc70dbd6d9c60 (patch)
tree58537db6ca082779bb82e8020d01d32813dff69c
parent8197732a3dd9df3071cf61ba4644ea826160fe05 (diff)
downloadbundler-segiddins/6750-allow-changing-local-gem-version.tar.gz
[Definition] Dont pin path deps to newer versionssegiddins/6750-allow-changing-local-gem-version
-rw-r--r--lib/bundler/definition.rb4
-rw-r--r--spec/install/gemfile/path_spec.rb14
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index ffcc7ff326..9d6fbfff59 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -977,7 +977,9 @@ module Bundler
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)
dep = Gem::Dependency.new(name, ">= #{locked_spec.version}")
requirements[name] = DepProxy.new(dep, locked_spec.platform)
requirements
diff --git a/spec/install/gemfile/path_spec.rb b/spec/install/gemfile/path_spec.rb
index f7789e7ea5..44d1e67106 100644
--- a/spec/install/gemfile/path_spec.rb
+++ b/spec/install/gemfile/path_spec.rb
@@ -132,6 +132,20 @@ RSpec.describe "bundle install with explicit source paths" do
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