Skip to content

Commit

Permalink
Merge branch 'v1.0.3' into 'main'
Browse files Browse the repository at this point in the history
fix delete directory if exists

See merge request fluxlabs/flux-eco/source-downloader!6
  • Loading branch information
mstuder committed Apr 1, 2022
2 parents afd3071 + 3ac5464 commit 80084bd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

## [1.0.5]
- fix: git - delete directory if exists

## [1.0.4]
- updated dependencies

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "flux-eco/source-downloader",
"description": "Component for flux-capacitor apps developed by fluxlabs",
"version": "1.0.4",
"version": "1.0.5",
"type": "flux-eco",
"keywords": [
"flux-eco",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ public function handle(Command $command) : void
return;
}

$deleteDirectory = 'rm -r ' . $command->getDirectoryPath();
$createDirectory = 'mkdir -p ' . $command->getDirectoryPath();
$deleteDirectory = '';
if(is_dir($command->getDirectoryPath())) {
$deleteDirectory = 'rm -r ' . $command->getDirectoryPath();
}
$createDirectory = $deleteDirectory .' && 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]);
$this->shellExecutorClient->execute([$createDirectory, $cdDirectory, $cloneRepository]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ public function handle(Command $command) : void
return;
}

$deleteDirectory = 'rm -r ' . $command->getDirectoryPath();
$createDirectory = 'mkdir -p ' . $command->getDirectoryPath();
$deleteDirectory = '';
if(is_dir($command->getDirectoryPath())) {
$deleteDirectory = 'rm -r ' . $command->getDirectoryPath();
}
$createDirectory = $deleteDirectory .' && mkdir -p ' . $command->getDirectoryPath();
$cdDirectory = 'cd ' . $command->getDirectoryPath();
$cloneRepository = 'git clone --depth 1 --branch '.$command->getTag() .' '. $command->getUrl().' '.$command->getDirectoryName();

Expand Down

0 comments on commit 80084bd

Please sign in to comment.