Websites/app/jobs/git_job.rb

23 lines
461 B
Ruby

# frozen_string_literal: true
class GitJob < ApplicationJob
include GoodJob::ActiveJobExtensions::Concurrency
queue_as :git
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