mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-03 15:02:34 +00:00
Plugins base (#613)
* wip * wip * cleanup * notification channels * phpstan * services * remove server types * refactoring * refactoring
This commit is contained in:
56
app/SSH/OS/Git.php
Normal file
56
app/SSH/OS/Git.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\SSH\OS;
|
||||
|
||||
use App\Exceptions\SSHError;
|
||||
use App\Models\Site;
|
||||
|
||||
class Git
|
||||
{
|
||||
/**
|
||||
* @throws SSHError
|
||||
*/
|
||||
public function clone(Site $site): void
|
||||
{
|
||||
$site->server->ssh($site->user)->exec(
|
||||
view('ssh.git.clone', [
|
||||
'host' => str($site->getFullRepositoryUrl())->after('@')->before('-'),
|
||||
'repo' => $site->getFullRepositoryUrl(),
|
||||
'path' => $site->path,
|
||||
'branch' => $site->branch,
|
||||
'key' => $site->getSshKeyName(),
|
||||
]),
|
||||
'clone-repository',
|
||||
$site->id
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SSHError
|
||||
*/
|
||||
public function checkout(Site $site): void
|
||||
{
|
||||
$site->server->ssh($site->user)->exec(
|
||||
view('ssh.git.checkout', [
|
||||
'path' => $site->path,
|
||||
'branch' => $site->branch,
|
||||
]),
|
||||
'checkout-branch',
|
||||
$site->id
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SSHError
|
||||
*/
|
||||
public function fetchOrigin(Site $site): void
|
||||
{
|
||||
$site->server->ssh($site->user)->exec(
|
||||
view('ssh.git.fetch-origin', [
|
||||
'path' => $site->path,
|
||||
]),
|
||||
'fetch-origin',
|
||||
$site->id
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user