From c11be0d014c52029acfec4d8f3cbe57cf993ee0f Mon Sep 17 00:00:00 2001 From: takahashim Date: Mon, 8 Nov 2021 23:52:30 +0900 Subject: [PATCH 1/2] Fix db:seed in docker This patch is from https://github.com/docker/for-linux/issues/1015#issuecomment-811453779 --- config/initializers/fileutils.rb | 1 + lib/monkey_patching_fileutils.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 config/initializers/fileutils.rb create mode 100644 lib/monkey_patching_fileutils.rb diff --git a/config/initializers/fileutils.rb b/config/initializers/fileutils.rb new file mode 100644 index 0000000000..abacdbe43b --- /dev/null +++ b/config/initializers/fileutils.rb @@ -0,0 +1 @@ +require_relative "../../lib/monkey_patching_fileutils" diff --git a/lib/monkey_patching_fileutils.rb b/lib/monkey_patching_fileutils.rb new file mode 100644 index 0000000000..d9dbdda716 --- /dev/null +++ b/lib/monkey_patching_fileutils.rb @@ -0,0 +1,13 @@ +# ref. https://github.com/docker/for-linux/issues/1015#issuecomment-811453779 +module FileUtilsDockerPatch + def copy_file(dest) + FileUtils.touch(path()) + super + end +end + +module FileUtils + class Entry_ + prepend FileUtilsDockerPatch + end +end From fb0d4382e81a9949ca3bc41bbc6e6422dfe74567 Mon Sep 17 00:00:00 2001 From: takahashim Date: Tue, 9 Nov 2021 00:09:59 +0900 Subject: [PATCH 2/2] Fixed by rubocop --- config/initializers/fileutils.rb | 2 ++ lib/monkey_patching_fileutils.rb | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/initializers/fileutils.rb b/config/initializers/fileutils.rb index abacdbe43b..1077050d4e 100644 --- a/config/initializers/fileutils.rb +++ b/config/initializers/fileutils.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + require_relative "../../lib/monkey_patching_fileutils" diff --git a/lib/monkey_patching_fileutils.rb b/lib/monkey_patching_fileutils.rb index d9dbdda716..ef562433ea 100644 --- a/lib/monkey_patching_fileutils.rb +++ b/lib/monkey_patching_fileutils.rb @@ -1,13 +1,15 @@ +# frozen_string_literal: true + # ref. https://github.com/docker/for-linux/issues/1015#issuecomment-811453779 module FileUtilsDockerPatch def copy_file(dest) - FileUtils.touch(path()) + FileUtils.touch(path) super end end module FileUtils - class Entry_ + class Entry_ # rubocop:disable Naming/ClassAndModuleCamelCase prepend FileUtilsDockerPatch end end