-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
example, gitclonestatehandler See merge request fluxlabs/flux-eco/source-downloader!2
- Loading branch information
Showing
23 changed files
with
230 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
# CHANGELOG | ||
|
||
## [1.0.0] | ||
- first version | ||
## [1.0.3] | ||
- added example | ||
- added gitCloneStateHandler | ||
- added shell argument handling | ||
|
||
## [1.0.2] | ||
- added flux-publisher | ||
|
||
## [1.0.1] | ||
- fixed bug with env variables | ||
|
||
## [1.0.2] | ||
- added flux-publisher | ||
## [1.0.0] | ||
- first version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
php ../../bin/downloadSources.php '../examples/ilias/sourceList.yaml' '/tmp' 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- sourceType: git | ||
url: https://github.com/fluxapps/SrContainerObjectMenu.git | ||
directoryPath: /var/www/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook | ||
directoryName: SrContainerObjectMenu | ||
tag: v2.5.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/Core/Application/DownloadHandlers/GitCloneCommandHandler.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace FluxEco\SourceDownloader\Core\Application\DownloadHandlers; | ||
|
||
use FluxEco\SourceDownloader\Core\{Domain\Models, Ports}; | ||
|
||
class GitCloneCommandHandler implements CommandHandler | ||
{ | ||
private Ports\ShellExecutor\ShellExecutorClient $shellExecutorClient; | ||
private bool $gitFullClone; | ||
private Process $process; | ||
|
||
private function __construct( | ||
Ports\ShellExecutor\ShellExecutorClient $shellExecutorClient, | ||
bool $gitFullClone, | ||
Process $process | ||
) { | ||
$this->shellExecutorClient = $shellExecutorClient; | ||
$this->gitFullClone = $gitFullClone; | ||
$this->process = $process; | ||
} | ||
|
||
public static function new(Ports\Configs\Outbounds $outbounds, Process $process) : self | ||
{ | ||
return new self($outbounds->getShellExecutorClient(), $outbounds->getGitFullClone(), $process); | ||
} | ||
|
||
public function handle(Command $command) : void | ||
{ | ||
if ($command->getSourceType() !== Models\SourceTypeEnum::GIT || $this->gitFullClone === false) { | ||
$this->process->process($command); | ||
return; | ||
} | ||
|
||
$deleteDirectory = 'rm -r ' . $command->getDirectoryPath(); | ||
$createDirectory = 'mkdir -p ' . $command->getDirectoryPath(); | ||
$cdDirectory = 'cd ' . $command->getDirectoryPath(); | ||
$cloneRepository = 'git clone --branch ' . $command->getTag() . ' ' . $command->getUrl() . ' ' . $command->getDirectoryName(); | ||
|
||
$this->shellExecutorClient->execute([$deleteDirectory, $createDirectory, $cdDirectory, $cloneRepository]); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/Core/Application/DownloadHandlers/GitCloneStateCommandHandler.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace FluxEco\SourceDownloader\Core\Application\DownloadHandlers; | ||
|
||
use FluxEco\SourceDownloader\Core\{Domain\Models, Ports}; | ||
|
||
class GitCloneStateCommandHandler implements CommandHandler | ||
{ | ||
private Ports\ShellExecutor\ShellExecutorClient $shellExecutorClient; | ||
private bool $gitFullClone; | ||
private Process $process; | ||
|
||
private function __construct( | ||
Ports\ShellExecutor\ShellExecutorClient $shellExecutorClient, | ||
bool $gitFullClone, | ||
Process $process | ||
) { | ||
$this->shellExecutorClient = $shellExecutorClient; | ||
$this->gitFullClone = $gitFullClone; | ||
$this->process = $process; | ||
} | ||
|
||
public static function new(Ports\Configs\Outbounds $outbounds, Process $process) : self | ||
{ | ||
return new self($outbounds->getShellExecutorClient(), $outbounds->getGitFullClone(), $process); | ||
} | ||
|
||
public function handle(Command $command) : void | ||
{ | ||
if ($command->getSourceType() !== Models\SourceTypeEnum::GIT || $this->gitFullClone === true) { | ||
$this->process->process($command); | ||
return; | ||
} | ||
|
||
$deleteDirectory = 'rm -r ' . $command->getDirectoryPath(); | ||
$createDirectory = 'mkdir -p ' . $command->getDirectoryPath(); | ||
$cdDirectory = 'cd ' . $command->getDirectoryPath(); | ||
$cloneRepository = 'git clone --depth 1 --branch '.$command->getTag() .' '. $command->getUrl().' '.$command->getDirectoryName(); | ||
|
||
$this->shellExecutorClient->execute([$deleteDirectory, $createDirectory, $cdDirectory, $cloneRepository]); | ||
} | ||
} |
36 changes: 0 additions & 36 deletions
36
src/Core/Application/DownloadHandlers/GitCommandHandler.php
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.