mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 07:41:42 +00:00
feat: poder pushear a cualquier remoto
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
parent
c176a8a4b4
commit
aeaf72c270
1 changed files with 12 additions and 5 deletions
|
@ -158,22 +158,29 @@ class Site
|
|||
|
||||
# Pushea cambios al repositorio remoto
|
||||
#
|
||||
# @param :remote [Rugged::Remote]
|
||||
# @return [Boolean, nil]
|
||||
def push
|
||||
origin.push(rugged.head.canonical_name, credentials: credentials)
|
||||
git_sh("git", "lfs", "push", "origin", default_branch)
|
||||
def push(remote = origin)
|
||||
remote.push(rugged.head.canonical_name, credentials: credentials_for(remote))
|
||||
git_sh('git', 'lfs', 'push', remote.name, default_branch)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# @deprecated
|
||||
def credentials
|
||||
@credentials ||= credentials_for(origin)
|
||||
end
|
||||
|
||||
# Si Sutty tiene una llave privada de tipo ED25519, devuelve las
|
||||
# credenciales necesarias para trabajar con repositorios remotos.
|
||||
#
|
||||
# @param :remote [Rugged::Remote]
|
||||
# @return [Nil, Rugged::Credentials::SshKey]
|
||||
def credentials
|
||||
def credentials_for(remote)
|
||||
return unless File.exist? private_key
|
||||
|
||||
Rugged::Credentials::SshKey.new username: username_for(origin), publickey: public_key, privatekey: private_key
|
||||
Rugged::Credentials::SshKey.new username: username_for(remote), publickey: public_key, privatekey: private_key
|
||||
end
|
||||
|
||||
# Obtiene el nombre de usuario para el repositorio remoto, por
|
||||
|
|
Loading…
Reference in a new issue