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

View File

@ -5,13 +5,13 @@ module StorageManager
def delete(path) def delete(path)
return unless exists?(path) return unless exists?(path)
super 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 end
def put(path, io) def put(path, io)
super super
if exists?(path) # rubocop:disable Style/IfUnlessModifier 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
end end