5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-24 22:56: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]
# @return [nil]
def perform(site)
#detectar que el repo local tiene repo remoto
site.repository.push if site.repository.origin
end
end

View file

@ -153,7 +153,7 @@ class Site
#
# @return [Boolean]
def gc
git_sh("git gc")
git_sh("git", "gc")
end
# Pushea cambios al repositorio remoto
@ -161,7 +161,7 @@ class Site
# @return [Boolean, nil]
def push
origin.push(rugged.head.canonical_name, credentials: credentials)
git_sh("git lfs push")
git_sh("git", "lfs", "push", "origin", default_branch)
end
private
@ -190,11 +190,15 @@ class Site
Pathname.new(file).relative_path_from(Pathname.new(path)).to_s
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 }
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
end