25 lines
516 B
Ruby
25 lines
516 B
Ruby
# frozen_string_literal: true
|
|
|
|
class GitJob < ApplicationJob
|
|
include GoodJob::ActiveJobExtensions::Concurrency
|
|
|
|
queue_as :git
|
|
|
|
good_job_control_concurrency_with(perform_limit: 1)
|
|
|
|
def perform(identifier, base_path, *commands)
|
|
commands.each do |command|
|
|
system!(command, path: base_path)
|
|
end
|
|
rescue StandardError => e
|
|
ExceptionLog.add(e, source: "GitJob", identifier: identifier)
|
|
raise(e)
|
|
end
|
|
|
|
private
|
|
|
|
def system!(*, path:)
|
|
system(*, exception: true, chdir: path)
|
|
end
|
|
end
|