mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-20 16:16:21 +00:00
Merge branch 'issue-12919' of https://0xacab.org/sutty/sutty into 17.3.alpine.panel.sutty.nl
This commit is contained in:
commit
f7f5f4dcac
4 changed files with 26 additions and 1 deletions
|
@ -477,7 +477,10 @@ class Site < ApplicationRecord
|
||||||
def clone_skel!
|
def clone_skel!
|
||||||
return if jekyll?
|
return if jekyll?
|
||||||
|
|
||||||
Rugged::Repository.clone_at(ENV['SKEL_SUTTY'], path, checkout_branch: design.gem, remote: 'upstream')
|
Rugged::Repository.clone_at(ENV['SKEL_SUTTY'], path, checkout_branch: design.gem
|
||||||
|
|
||||||
|
# Necesita un bloque
|
||||||
|
repository.rugged.remotes.rename('origin', 'upstream') {}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Elimina el directorio del sitio
|
# Elimina el directorio del sitio
|
||||||
|
|
|
@ -102,6 +102,8 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do
|
||||||
usuarie: usuarie,
|
usuarie: usuarie,
|
||||||
message: I18n.t("post_service.#{action}",
|
message: I18n.t("post_service.#{action}",
|
||||||
title: post&.title&.value))
|
title: post&.title&.value))
|
||||||
|
|
||||||
|
GitPushJob.perform_later(site)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Solo permitir cambiar estos atributos de cada articulo
|
# Solo permitir cambiar estos atributos de cada articulo
|
||||||
|
|
|
@ -97,6 +97,8 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do
|
||||||
add: [site.config.path],
|
add: [site.config.path],
|
||||||
message: I18n.t("site_service.#{action}",
|
message: I18n.t("site_service.#{action}",
|
||||||
name: site.name))
|
name: site.name))
|
||||||
|
|
||||||
|
GitPushJob.perform_later(site)
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_role(temporal: true, rol: 'invitade')
|
def add_role(temporal: true, rol: 'invitade')
|
||||||
|
|
18
db/migrate/20230921155401_site_rename_origin_to_upstream.rb
Normal file
18
db/migrate/20230921155401_site_rename_origin_to_upstream.rb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Renombrar todos los repositorios que apunten a skel como su origin
|
||||||
|
class SiteRenameOriginToUpstream < ActiveRecord::Migration[6.1]
|
||||||
|
# Renombrar
|
||||||
|
def up
|
||||||
|
Site.find_each do |site|
|
||||||
|
next unless site.repository.origin&.url == ENV['SKEL_SUTTY']
|
||||||
|
|
||||||
|
site.repository.rugged.remotes.rename('origin', 'upstream')
|
||||||
|
rescue Rugged::Error => e
|
||||||
|
Rails.logger.warn "#{site.name}: #{e.message}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# No se puede deshacer
|
||||||
|
def down; end
|
||||||
|
end
|
Loading…
Reference in a new issue