[rubygems/rubygems] Small simplification in Definition class

https://github.com/rubygems/rubygems/commit/03ddfd7610

Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
This commit is contained in:
David Rodríguez 2024-09-11 17:06:44 +02:00 committed by git
parent 364cc95897
commit 12d7ead043

View File

@ -511,11 +511,7 @@ module Bundler
end
def lockfile_exists?
file_exists?(lockfile)
end
def file_exists?(file)
file && File.exist?(file)
lockfile && File.exist?(lockfile)
end
def write_lock(file, preserve_unknown_sections)
@ -536,7 +532,7 @@ module Bundler
preserve_unknown_sections ||= !updating_major && (Bundler.frozen_bundle? || !(unlocking? || @unlocking_bundler))
if file_exists?(file) && lockfiles_equal?(@lockfile_contents, contents, preserve_unknown_sections)
if File.exist?(file) && lockfiles_equal?(@lockfile_contents, contents, preserve_unknown_sections)
return if Bundler.frozen_bundle?
SharedHelpers.filesystem_access(file) { FileUtils.touch(file) }
return