Skip to content

Commit

Permalink
[rubygems/rubygems] bundle lock: Always touch the lockfile
Browse files Browse the repository at this point in the history
  • Loading branch information
franzliedke authored and matzbot committed Dec 12, 2023
1 parent 8c2480c commit 0ec88b5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/bundler/cli/lock.rb
Expand Up @@ -64,6 +64,7 @@ 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
16 changes: 16 additions & 0 deletions spec/bundler/commands/lock_spec.rb
Expand Up @@ -95,6 +95,22 @@
expect(out).to eq(remove_checksums_from_lockfile(@lockfile).chomp)
end

it "touches the lockfile when there is an existing lockfile that does not need changes" do
lockfile @lockfile

expect do
bundle "lock"
end.to change { bundled_app_lock.mtime }
end

it "does not touch lockfile with --print" do
lockfile @lockfile

expect do
bundle "lock --print"
end.not_to change { bundled_app_lock.mtime }
end

it "writes a lockfile when there is an outdated lockfile using --update" do
lockfile remove_checksums_from_lockfile(@lockfile.gsub("2.3.2", "2.3.1"), " (2.3.1)")

Expand Down

0 comments on commit 0ec88b5

Please sign in to comment.