This commit is contained in:
Alexey Berezhok
2026-05-03 16:32:53 +03:00
parent 8add078e7c
commit a3888d10b4
10 changed files with 267 additions and 5 deletions

View File

@@ -2,6 +2,7 @@
require 'pathname'
require 'fileutils'
require 'digest'
class UpdateWorker < Kernel::ModuleCoreWorker
MODULE_ID = "update_module"
@@ -17,7 +18,6 @@ class UpdateWorker < Kernel::ModuleCoreWorker
end
def file_changed?(new_file, old_file)
require 'digest/sha256'
return true unless File.exist?(old_file)
new_hash = Digest::SHA256.file(new_file).hexdigest
old_hash = Digest::SHA256.file(old_file).hexdigest
@@ -80,6 +80,9 @@ class UpdateWorker < Kernel::ModuleCoreWorker
result = []
result = list.map do |new_dir, new_file, old_file|
file_name = Pathname.new(new_file).relative_path_from(Pathname.new(new_dir)).to_s
dir_name = File.basename(new_dir)
relative_path = Pathname.new(new_file).relative_path_from(Pathname.new(new_dir)).to_s
file_name = File.join(dir_name, relative_path)
{
"FILE_NAME" => file_name,
"NEW_SIZE" => File.size(new_file),