[rubygems/rubygems] Restore working bundle check
behaviour
As part of a recent bug fix where bundler was accidentally hitting the
network when not supposed to, I made some refactoring, and the commit I'm
reverting here
(d74830d00b
)
was some cleanup that those refactorings allowed according to "past me".
That was completely wrong, `bundle check` should never consider cached
gems, only installed gems, so the code that was removed was necessary.
https://github.com/rubygems/rubygems/commit/5483e98305
This commit is contained in:
parent
71f6711351
commit
3683781f53
Notes:
git
2021-08-31 19:07:06 +09:00
@ -15,7 +15,7 @@ module Bundler
|
||||
definition.validate_runtime!
|
||||
|
||||
begin
|
||||
definition.resolve_with_cache!
|
||||
definition.resolve_only_locally!
|
||||
not_installed = definition.missing_specs
|
||||
rescue GemNotFound, VersionConflict
|
||||
Bundler.ui.error "Bundler can't satisfy your Gemfile's dependencies."
|
||||
|
@ -166,6 +166,12 @@ module Bundler
|
||||
@multisource_allowed
|
||||
end
|
||||
|
||||
def resolve_only_locally!
|
||||
@remote = false
|
||||
sources.local_only!
|
||||
resolve
|
||||
end
|
||||
|
||||
def resolve_with_cache!
|
||||
sources.cached!
|
||||
resolve
|
||||
|
@ -36,6 +36,8 @@ module Bundler
|
||||
|
||||
def local!; end
|
||||
|
||||
def local_only!; end
|
||||
|
||||
def cached!; end
|
||||
|
||||
def remote!; end
|
||||
|
@ -26,6 +26,12 @@ module Bundler
|
||||
Array(options["remotes"]).reverse_each {|r| add_remote(r) }
|
||||
end
|
||||
|
||||
def local_only!
|
||||
@specs = nil
|
||||
@allow_local = true
|
||||
@allow_remote = false
|
||||
end
|
||||
|
||||
def local!
|
||||
return if @allow_local
|
||||
|
||||
|
@ -136,6 +136,10 @@ module Bundler
|
||||
different_sources?(lock_sources, replacement_sources)
|
||||
end
|
||||
|
||||
def local_only!
|
||||
all_sources.each(&:local_only!)
|
||||
end
|
||||
|
||||
def cached!
|
||||
all_sources.each(&:cached!)
|
||||
end
|
||||
|
@ -137,6 +137,22 @@ RSpec.describe "bundle check" do
|
||||
expect(exitstatus).to eq(1)
|
||||
end
|
||||
|
||||
it "ensures that gems are actually installed and not just cached in applications' cache" do
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
gem "rack"
|
||||
G
|
||||
|
||||
bundle "config set --local path vendor/bundle"
|
||||
bundle :cache
|
||||
|
||||
gem_command "uninstall rack", :env => { "GEM_HOME" => vendored_gems.to_s }
|
||||
|
||||
bundle "check", :raise_on_error => false
|
||||
expect(err).to include("* rack (1.0.0)")
|
||||
expect(exitstatus).to eq(1)
|
||||
end
|
||||
|
||||
it "ignores missing gems restricted to other platforms" do
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo1)}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user