diff --git a/app/jobs/git_job.rb b/app/jobs/git_job.rb index 1b9f8c6..6d4a3a4 100644 --- a/app/jobs/git_job.rb +++ b/app/jobs/git_job.rb @@ -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 diff --git a/app/logical/storage_manager/git.rb b/app/logical/storage_manager/git.rb index 9e2d845..1625402 100644 --- a/app/logical/storage_manager/git.rb +++ b/app/logical/storage_manager/git.rb @@ -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