A lot :)
Some checks failed
/ Run tests (push) Successful in 8m56s
/ Run system tests (push) Failing after 1h0m48s
/ Build, push and deploy image (push) Successful in 7m47s

This commit is contained in:
david 2024-09-05 22:54:38 +02:00
parent aad67af0d1
commit 63fc206c27
153 changed files with 2043 additions and 646 deletions

View file

@ -1,10 +1,12 @@
# frozen_string_literal: true
module Admin
class Backup
class << self
def zip
create_records_xlsx
ZipFileGenerator.new(Rails.root.join('storage')).write
ZipFileGenerator.new(Rails.root.join("storage")).write
end
def db_xlsx
@ -21,7 +23,7 @@ module Admin
end
end
end
path = Rails.root.join('storage/data.xls')
path = Rails.root.join("storage/data.xls")
xlsx.serialize(path)
path
end
@ -29,7 +31,7 @@ module Admin
private
def file_path(name)
Rails.root.join('storage', name)
Rails.root.join("storage", name)
end
end
end
@ -53,9 +55,9 @@ module Admin
# Zip the input directory.
def write
entries = Dir.entries(@input_dir) - %w[. ..]
path = Rails.root.join('tmp', Time.now.to_i.to_s)
path = Rails.root.join("tmp", Time.now.to_i.to_s)
::Zip::File.open(path, create: true) do |zipfile|
write_entries entries, '', zipfile
write_entries entries, "", zipfile
end
path
end
@ -65,7 +67,7 @@ module Admin
# A helper method to make the recursion work.
def write_entries(entries, path, zipfile)
entries.each do |e|
zipfile_path = path == '' ? e : File.join(path, e)
zipfile_path = path == "" ? e : File.join(path, e)
disk_file_path = File.join(@input_dir, zipfile_path)
if File.directory? disk_file_path