2023-07-20 17:58:21 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-10-31 16:54:19 +00:00
|
|
|
# Permite traer los cambios desde el repositorio remoto
|
2023-07-20 17:58:21 +00:00
|
|
|
class GitPullJob < ApplicationJob
|
2023-10-31 16:54:19 +00:00
|
|
|
# @param :site [Site]
|
|
|
|
# @param :usuarie [Usuarie]
|
|
|
|
# @param :message [String]
|
|
|
|
# @return [nil]
|
|
|
|
def perform(site, usuarie, message)
|
|
|
|
site.repository.fetch
|
2023-10-31 16:53:45 +00:00
|
|
|
|
2023-10-31 16:54:19 +00:00
|
|
|
return if site.repository.up_to_date?
|
2023-10-31 16:53:45 +00:00
|
|
|
|
2023-10-31 16:54:19 +00:00
|
|
|
if site.repository.fast_forward?
|
|
|
|
site.repository.fast_forward!
|
|
|
|
else
|
2023-10-31 16:53:45 +00:00
|
|
|
site.repository.merge(usuarie, message)
|
2023-07-20 17:58:21 +00:00
|
|
|
end
|
2023-10-31 16:54:19 +00:00
|
|
|
|
|
|
|
git_lfs_checkout
|
|
|
|
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
end
|