fix git job again

This commit is contained in:
Donovan Daniels 2024-10-21 11:12:11 -05:00
parent 6516a9df57
commit e99bdc9906
Signed by: Donovan_DMC
GPG Key ID: 907D29CBFD6157BA
2 changed files with 6 additions and 6 deletions

View File

@ -7,9 +7,9 @@ class GitJob < ApplicationJob
good_job_control_concurrency_with(perform_limit: 1)
def perform(identifier, *commands)
def perform(identifier, base_path, *commands)
commands.each do |command|
system!(command)
system!(command, path: base_path)
end
rescue StandardError => e
ExceptionLog.add(e, source: "GitJob", identifier: identifier)
@ -18,7 +18,7 @@ class GitJob < ApplicationJob
private
def system!(*)
system(*, exception: true, chdir: Websites.config.yiffy2_storage.base_path)
def system!(*, path:)
system(*, exception: true, chdir: path)
end
end

View File

@ -5,13 +5,13 @@ module StorageManager
def delete(path)
return unless exists?(path)
super
GitJob.perform_later("#{base_path}#{path}", "git add #{base_path}#{path}", "git commit -m \"Remove #{path[1..]}\"", "git push")
GitJob.perform_later("#{base_path}#{path}", base_path, "git add #{base_path}#{path}", "git commit -m \"Remove #{path[1..]}\"", "git push")
end
def put(path, io)
super
if exists?(path) # rubocop:disable Style/IfUnlessModifier
GitJob.perform_later("#{base_path}#{path}", "git add #{base_path}#{path}", "git commit -m \"Add #{path[1..]}\"", "git push")
GitJob.perform_later("#{base_path}#{path}", base_path, "git add #{base_path}#{path}", "git commit -m \"Add #{path[1..]}\"", "git push")
end
end