5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 05:31:42 +00:00

fix: change git_sh method to accept array of params #12919
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
jazzari 2023-07-20 15:31:38 -03:00
parent 42b6744f81
commit ca9fa31cf1
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

@ -154,7 +154,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
@ -162,7 +162,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
@ -191,11 +191,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