Skip to content

Commit

Permalink
[rubygems/rubygems] Refactor: Move filesystem access into Definition …
Browse files Browse the repository at this point in the history
  • Loading branch information
franzliedke authored and matzbot committed Dec 12, 2023
1 parent 0ec88b5 commit 0653fb0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion lib/bundler/cli/lock.rb
Expand Up @@ -64,7 +64,6 @@ def run
file = file ? File.expand_path(file) : Bundler.default_lockfile
puts "Writing lockfile to #{file}"
definition.lock(file)
FileUtils.touch(file)
end
end

Expand Down
5 changes: 4 additions & 1 deletion lib/bundler/definition.rb
Expand Up @@ -342,7 +342,10 @@ def lock(file, preserve_unknown_sections = false)

preserve_unknown_sections ||= !updating_major && (Bundler.frozen_bundle? || !(unlocking? || @unlocking_bundler))

return if file && File.exist?(file) && lockfiles_equal?(@lockfile_contents, contents, preserve_unknown_sections)
if file && File.exist?(file) && lockfiles_equal?(@lockfile_contents, contents, preserve_unknown_sections)
FileUtils.touch(file)
return
end

if Bundler.frozen_bundle?
Bundler.ui.error "Cannot write a changed lockfile while frozen."
Expand Down

0 comments on commit 0653fb0

Please sign in to comment.