File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed
Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -389,9 +389,18 @@ def filter_prereleases(specs, package)
389389 end
390390
391391 def filter_remote_specs ( specs , package )
392- return specs unless package . prefer_local?
392+ if package . prefer_local?
393+ local_specs = specs . select { |s | s . is_a? ( StubSpecification ) }
393394
394- specs . select { |s | s . is_a? ( StubSpecification ) }
395+ if local_specs . empty?
396+ package . consider_remote_versions!
397+ specs
398+ else
399+ local_specs
400+ end
401+ else
402+ specs
403+ end
395404 end
396405
397406 # Ignore versions that depend on themselves incorrectly
Original file line number Diff line number Diff line change @@ -1606,6 +1606,26 @@ def run
16061606 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" )
16071607 expect ( last_command ) . to be_success
16081608 end
1609+
1610+ it "resolves to the latest version if no gems are available locally" do
1611+ build_repo4 do
1612+ build_gem "myreline" , "0.3.8"
1613+ build_gem "debug" , "0.2.1"
1614+
1615+ build_gem "debug" , "1.10.0" do |s |
1616+ s . add_dependency "myreline"
1617+ end
1618+ end
1619+
1620+ install_gemfile <<~G , "prefer-local" : true , verbose : true
1621+ source "https://gem.repo4"
1622+
1623+ gem "debug"
1624+ G
1625+
1626+ 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" )
1627+ expect ( last_command ) . to be_success
1628+ end
16091629 end
16101630
16111631 context "with a symlinked configured as bundle path and a gem with symlinks" do
You can’t perform that action at this time.
0 commit comments