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-09-27 19:46:33 +00:00
|
|
|
# @param :site [Site]
|
|
|
|
# @param :usuarie [Usuarie]
|
2023-09-27 19:52:24 +00:00
|
|
|
# @param :message [String]
|
2023-09-27 19:46:33 +00:00
|
|
|
# @return [nil]
|
2023-09-27 19:52:24 +00:00
|
|
|
def perform(site, usuarie, message)
|
2024-04-12 18:31:47 +00:00
|
|
|
@site = site
|
|
|
|
|
2023-09-27 19:54:38 +00:00
|
|
|
return unless site.repository.origin
|
2023-09-27 19:46:33 +00:00
|
|
|
|
2023-10-31 16:54:19 +00:00
|
|
|
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
|
|
|
|
2023-10-31 16:59:59 +00:00
|
|
|
site.repository.git_lfs_checkout
|
2023-09-27 19:47:00 +00:00
|
|
|
site.reindex_changes!
|
2023-10-31 16:54:19 +00:00
|
|
|
|
|
|
|
nil
|
2023-09-27 19:46:33 +00:00
|
|
|
end
|
|
|
|
end
|