[rubygems/rubygems] --prefer-local
should resolve to latest version if no gems are available locally
Filtering out remote specs should only apply where there are locally installed specs. Otherwise they should always be considered. https://github.com/rubygems/rubygems/commit/118f8389a1
This commit is contained in:
parent
151b436c9d
commit
ee03df26ba
@ -389,9 +389,18 @@ module Bundler
|
|||||||
end
|
end
|
||||||
|
|
||||||
def filter_remote_specs(specs, package)
|
def filter_remote_specs(specs, package)
|
||||||
return specs unless package.prefer_local?
|
if package.prefer_local?
|
||||||
|
local_specs = specs.select {|s| s.is_a?(StubSpecification) }
|
||||||
|
|
||||||
specs.select {|s| s.is_a?(StubSpecification) }
|
if local_specs.empty?
|
||||||
|
package.consider_remote_versions!
|
||||||
|
specs
|
||||||
|
else
|
||||||
|
local_specs
|
||||||
|
end
|
||||||
|
else
|
||||||
|
specs
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Ignore versions that depend on themselves incorrectly
|
# Ignore versions that depend on themselves incorrectly
|
||||||
|
@ -1606,6 +1606,26 @@ RSpec.describe "bundle install with gem sources" do
|
|||||||
expect(out).to include("Fetching foo 1.0.1").and include("Installing foo 1.0.1").and include("Fetching b 1.0.0").and include("Installing b 1.0.0")
|
expect(out).to include("Fetching foo 1.0.1").and include("Installing foo 1.0.1").and include("Fetching b 1.0.0").and include("Installing b 1.0.0")
|
||||||
expect(last_command).to be_success
|
expect(last_command).to be_success
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "resolves to the latest version if no gems are available locally" do
|
||||||
|
build_repo4 do
|
||||||
|
build_gem "myreline", "0.3.8"
|
||||||
|
build_gem "debug", "0.2.1"
|
||||||
|
|
||||||
|
build_gem "debug", "1.10.0" do |s|
|
||||||
|
s.add_dependency "myreline"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
install_gemfile <<~G, "prefer-local": true, verbose: true
|
||||||
|
source "https://gem.repo4"
|
||||||
|
|
||||||
|
gem "debug"
|
||||||
|
G
|
||||||
|
|
||||||
|
expect(out).to include("Fetching debug 1.10.0").and include("Installing debug 1.10.0").and include("Fetching myreline 0.3.8").and include("Installing myreline 0.3.8")
|
||||||
|
expect(last_command).to be_success
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with a symlinked configured as bundle path and a gem with symlinks" do
|
context "with a symlinked configured as bundle path and a gem with symlinks" do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user