mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-18 17:26:21 +00:00
Merge branch 'issue-14533' of https://0xacab.org/sutty/sutty into 17.3.alpine.panel.sutty.nl
This commit is contained in:
commit
854389a031
5 changed files with 51 additions and 16 deletions
|
@ -68,7 +68,7 @@ module Api
|
|||
|
||||
# respuesta de error a plataformas
|
||||
def platforms_answer(exception)
|
||||
ExceptionNotifier.notify_exception(exception, env: request.env, data: { headers: request.headers.to_h })
|
||||
ExceptionNotifier.notify_exception(exception, data: { headers: request.headers.to_h }
|
||||
|
||||
head :forbidden
|
||||
end
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Permite traer los cambios desde webhooks
|
||||
|
||||
# Permite traer los cambios desde el repositorio remoto
|
||||
class GitPullJob < ApplicationJob
|
||||
# @param :site [Site]
|
||||
# @param :usuarie [Usuarie]
|
||||
|
@ -9,9 +8,20 @@ class GitPullJob < ApplicationJob
|
|||
# @return [nil]
|
||||
def perform(site, usuarie, message)
|
||||
return unless site.repository.origin
|
||||
return unless site.repository.fetch.positive?
|
||||
|
||||
site.repository.fetch
|
||||
|
||||
return if site.repository.up_to_date?
|
||||
|
||||
if site.repository.fast_forward?
|
||||
site.repository.fast_forward!
|
||||
else
|
||||
site.repository.merge(usuarie, message)
|
||||
end
|
||||
|
||||
git_lfs_checkout
|
||||
site.reindex_changes!
|
||||
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
|
|
@ -76,12 +76,17 @@ class Site
|
|||
# escribir los cambios
|
||||
rugged.checkout 'HEAD', strategy: :force
|
||||
|
||||
git_sh("git", "lfs", "fetch", "origin", default_branch)
|
||||
# reemplaza los pointers por los archivos correspondientes
|
||||
git_sh("git", "lfs", "checkout")
|
||||
commit
|
||||
end
|
||||
|
||||
# Trae todos los archivos desde LFS
|
||||
#
|
||||
# @return [Boolean]
|
||||
def git_lfs_checkout
|
||||
git_sh('git', 'lfs', 'fetch', 'origin', default_branch)
|
||||
git_sh('git', 'lfs', 'checkout')
|
||||
end
|
||||
|
||||
# El último commit
|
||||
#
|
||||
# @return [Rugged::Commit]
|
||||
|
@ -111,10 +116,30 @@ class Site
|
|||
walker.each.to_a
|
||||
end
|
||||
|
||||
# Hay commits sin aplicar?
|
||||
def needs_pull?
|
||||
fetch
|
||||
!commits.empty?
|
||||
# Detecta si hay que hacer un pull o no
|
||||
#
|
||||
# @return [Boolean]
|
||||
def up_to_date?
|
||||
rugged.merge_analysis(remote_head_commit).include?(:up_to_date)
|
||||
end
|
||||
|
||||
# Detecta si es posible adelantar la historia local a la remota o
|
||||
# necesitamos un merge
|
||||
#
|
||||
# @return [Boolean]
|
||||
def fast_forward?
|
||||
rugged.merge_analysis(remote_head_commit).include?(:fastforward)
|
||||
end
|
||||
|
||||
# Mueve la historia local a la remota
|
||||
#
|
||||
# @see {https://stackoverflow.com/a/27077322}
|
||||
# @return [nil]
|
||||
def fast_forward!
|
||||
rugged.checkout_tree(remote_head_commit)
|
||||
rugged.references.update(rugged.head.resolve, remote_head_commit.oid)
|
||||
|
||||
nil
|
||||
end
|
||||
|
||||
# Guarda los cambios en git
|
||||
|
|
|
@ -125,8 +125,8 @@ module Jekyll
|
|||
|
||||
unless spec
|
||||
I18n.with_locale(locale) do
|
||||
raise ArgumentError, I18n.t('activerecord.errors.models.site.attributes.design_id.missing_gem', theme: name)
|
||||
rescue ArgumentError => e
|
||||
raise Jekyll::Errors::InvalidThemeName, I18n.t('activerecord.errors.models.site.attributes.design_id.missing_gem', theme: name)
|
||||
rescue Jekyll::Errors::InvalidThemeName => e
|
||||
ExceptionNotifier.notify_exception(e, data: { theme: name, site: File.basename(site.source) })
|
||||
raise
|
||||
end
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
- name_en: 'Minima'
|
||||
name_es: 'Mínima'
|
||||
gem: 'sutty-minima'
|
||||
url: 'https://0xacab.org/sutty/jekyll/minima'
|
||||
url: 'https://minima.sutty.nl/'
|
||||
description_en: "Sutty Minima is based on [Minima](https://jekyll.github.io/minima/), a blog-focused theme for Jekyll."
|
||||
description_es: 'Sutty Mínima es una plantilla para blogs basada en [Mínima](https://jekyll.github.io/minima/).'
|
||||
license: 'https://0xacab.org/sutty/jekyll/minima/-/blob/master/LICENSE.txt'
|
||||
|
|
Loading…
Reference in a new issue