From 32327eb12320087aaefb382a17e1c517207e1571 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Fri, 7 Jul 2017 08:17:01 +0900 Subject: Do not update `secrets.yml.enc` when secretes do not change Currently, if open a file with `secrets:edit` command, `secrets.yml.enc` will be changed even if its contents do not change. Therefore, even if only want to check secrets, the difference will come out. This is a little inconvenient. As a fix to the above problem, when content does not change, `secrets.yml.ecn` is fixed so that it is not changed. --- railties/lib/rails/secrets.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'railties/lib') diff --git a/railties/lib/rails/secrets.rb b/railties/lib/rails/secrets.rb index c7a8676d7b..955ab096e8 100644 --- a/railties/lib/rails/secrets.rb +++ b/railties/lib/rails/secrets.rb @@ -105,7 +105,9 @@ module Rails yield tmp_path - write(File.read(tmp_path)) + updated_contents = File.read(tmp_path) + + write(updated_contents) if updated_contents != contents ensure FileUtils.rm(tmp_path) if File.exist?(tmp_path) end -- cgit v1.2.3