5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-25 03:36: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:
Sutty 2023-07-21 20:29:07 +00:00
commit ee3b1ab896
2 changed files with 8 additions and 5 deletions

View file

@ -6,7 +6,6 @@ class GitPushJob < ApplicationJob
# @param :site [Site] # @param :site [Site]
# @return [nil] # @return [nil]
def perform(site) def perform(site)
#detectar que el repo local tiene repo remoto
site.repository.push if site.repository.origin site.repository.push if site.repository.origin
end end
end end

View file

@ -153,7 +153,7 @@ class Site
# #
# @return [Boolean] # @return [Boolean]
def gc def gc
git_sh("git gc") git_sh("git", "gc")
end end
# Pushea cambios al repositorio remoto # Pushea cambios al repositorio remoto
@ -161,7 +161,7 @@ class Site
# @return [Boolean, nil] # @return [Boolean, nil]
def push def push
origin.push(rugged.head.canonical_name, credentials: credentials) origin.push(rugged.head.canonical_name, credentials: credentials)
git_sh("git lfs push") git_sh("git", "lfs", "push", "origin", default_branch)
end end
private private
@ -190,11 +190,15 @@ class Site
Pathname.new(file).relative_path_from(Pathname.new(path)).to_s Pathname.new(file).relative_path_from(Pathname.new(path)).to_s
end end
def git_sh(cmd) # Ejecuta un comando de git
#
# @param :args [Array]
# @return [Boolean]
def git_sh(*args)
env = { 'PATH' => '/usr/bin', 'LANG' => ENV['LANG'], 'HOME' => path } env = { 'PATH' => '/usr/bin', 'LANG' => ENV['LANG'], 'HOME' => path }
r = nil r = nil
Open3.popen2e(env, cmd, unsetenv_others: true, chdir: path) do |_, _, t| Open3.popen2e(env, *args, unsetenv_others: true, chdir: path) do |_, _, t|
r = t.value r = t.value
end end