Skip to content

Commit

Permalink
Remove persistent_gems_after_clean workaround
Browse files Browse the repository at this point in the history
We put this check in place as a workaround for an internal project at
GitHub that was using some custom extensions to bundler. This has since
been removed, and this check is no longer relevant, so let's clean it
up.
  • Loading branch information
jurre committed May 11, 2023
1 parent f103d05 commit 178d9db
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 53 deletions.
11 changes: 1 addition & 10 deletions bundler/helpers/v2/lib/functions/lockfile_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def cache_vendored_gems(definition)
# Dependencies that have been unlocked for the update (including
# sub-dependencies)
unlocked_gems = definition.instance_variable_get(:@unlock).
fetch(:gems).reject { |gem| __keep_on_prune?(gem) }
fetch(:gems)
bundler_opts = {
cache_all: true,
cache_all_platforms: true,
Expand All @@ -85,15 +85,6 @@ def cache_vendored_gems(definition)
end
end

# This is not officially supported and may be removed without notice.
def __keep_on_prune?(spec_name)
unless (specs = Bundler.settings[:persistent_gems_after_clean])
return false
end

specs.include?(spec_name)
end

# Copied from Bundler::Runtime: Modified to only prune gems that have
# been unlocked
def prune_gem_cache(resolve, cache_path, unlocked_gems)
Expand Down
16 changes: 0 additions & 16 deletions bundler/spec/dependabot/bundler/file_updater_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1495,22 +1495,6 @@
expect(file.operation).to eq Dependabot::DependencyFile::Operation::DELETE
end

context "persistent gems after clean" do
let(:project_name) { "vendored_persistent_gems" }

it "does not delete cached files marked as persistent" do
file = updater.updated_dependency_files.find do |f|
f.name == "vendor/cache/business-1.4.0.gem"
end

vendor_files =
Dir.entries(Pathname.new(repo_contents_path).join("vendor/cache"))

expect(file).to be_nil
expect(vendor_files).to include("business-1.4.0.gem")
end
end

context "with dependencies that are not unlocked by the update" do
let(:project_name) { "conditional" }

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.

0 comments on commit 178d9db

Please sign in to comment.