Skip to content

Commit e5d8909

Browse files
committed
Change package for unzip from gbeushausen/distill to nelexa/zip
1 parent d0b8df7 commit e5d8909

File tree

5 files changed

+15
-23
lines changed

5 files changed

+15
-23
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6666
- `misc:generate:yaml:config` is now `deploy:generate:configration`
6767
- `misc:generate:yaml:module` is now `deploy:generate:module-activator`
6868
- `module:multiactivator` is now `deploy:module-activator`
69+
- Change package for unzip from gbeushausen/distill to nelexa/zip
6970

7071
### Removed
7172
- `oxrun.phar` use ./vendor/bin/oe-console

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
],
1717
"require": {
1818
"oxid-esales/oxideshop-ce": "^v6.5",
19-
"guzzlehttp/guzzle": "*"
19+
"guzzlehttp/guzzle": "*",
20+
"nelexa/zip": "*"
2021
},
2122
"require-dev": {
2223
"phpunit/phpunit": "^9",

src/Oxrun/Command/Module/GenerateCommand.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Oxrun\Command\Module;
44

5+
use OxidEsales\Facts\Facts;
56
use Oxrun\GenerateModule\CreateModule;
67
use Oxrun\GenerateModule\InteractModuleForm;
78
use Oxrun\GenerateModule\ModuleSpecification;
@@ -54,20 +55,22 @@ protected function execute(InputInterface $input, OutputInterface $output)
5455
}
5556

5657
$app = $this->getApplication();
58+
$oxSourcePath = (new Facts())->getSourcePath();
59+
$oxInstallationPath = (new Facts())->getShopRootPath();
5760

5861
$skeletonUri = $input->getOption('skeleton');
5962

6063
$output->writeln("Module will be create ... <info>please wait</info> ...");
6164
$output->writeln(" - Use Template: $skeletonUri", OutputInterface::VERBOSITY_VERBOSE);
6265

63-
$createModule = new CreateModule(OX_BASE_PATH, $app->getName(), $app->getVersion());
66+
$createModule = new CreateModule($oxSourcePath, $app->getName(), $app->getVersion());
6467
$createModule->run($skeletonUri, $this->moduleSpecification);
6568

66-
$destinationPath = $this->moduleSpecification->getDestinationPath(OX_BASE_PATH);
69+
$destinationPath = $this->moduleSpecification->getDestinationPath($oxSourcePath);
6770
$namespace = $this->moduleSpecification->getNamespace();
6871

6972
$output->write("Enable new namespace <comment>`$namespace`</comment>, ");
70-
$output->writeln('run <comment>`composer dumpautoload`</comment> into <comment>`'.INSTALLATION_ROOT_PATH.'`</comment>');
73+
$output->writeln('run <comment>`composer dumpautoload`</comment> into <comment>`' . $oxInstallationPath . '`</comment>');
7174
$output->writeln("<info>Module is stored at <comment>{$destinationPath}</comment></info>");
7275

7376
return 0;

src/Oxrun/GenerateModule/CreateModule.php

-7
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,6 @@ public function __construct($shopdir, $appname, $version, HandlerStack $mockHand
5757
/**
5858
* @param string $skeletonUri
5959
* @param ModuleSpecification $moduleSpecification
60-
*
61-
* @throws \Distill\Exception\IO\Input\FileEmptyException
62-
* @throws \Distill\Exception\IO\Input\FileFormatNotSupportedException
63-
* @throws \Distill\Exception\IO\Input\FileNotFoundException
64-
* @throws \Distill\Exception\IO\Input\FileNotReadableException
65-
* @throws \Distill\Exception\IO\Input\FileUnknownFormatException
66-
* @throws \Distill\Exception\IO\Output\TargetDirectoryNotWritableException
6760
*/
6861
public function run($skeletonUri, ModuleSpecification $moduleSpecification)
6962
{

src/Oxrun/GenerateModule/DownloadSkeleton.php

+6-12
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88

99
namespace Oxrun\GenerateModule;
1010

11-
use Distill\Distill;
12-
use Distill\Format;
1311
use GuzzleHttp\Client;
1412
use GuzzleHttp\Exception\BadResponseException;
1513
use GuzzleHttp\Psr7\Request;
1614
use GuzzleHttp\RequestOptions;
15+
use PhpZip\ZipFile;
1716
use Symfony\Component\Filesystem\Exception\FileNotFoundException;
1817
use Symfony\Component\Filesystem\Filesystem;
1918
use Symfony\Component\Finder\Finder;
19+
2020
use function GuzzleHttp\Psr7\stream_for;
2121

2222
/**
@@ -93,12 +93,6 @@ public function download($url)
9393

9494
/**
9595
* @param $destination
96-
* @throws \Distill\Exception\IO\Input\FileEmptyException
97-
* @throws \Distill\Exception\IO\Input\FileFormatNotSupportedException
98-
* @throws \Distill\Exception\IO\Input\FileNotFoundException
99-
* @throws \Distill\Exception\IO\Input\FileNotReadableException
100-
* @throws \Distill\Exception\IO\Input\FileUnknownFormatException
101-
* @throws \Distill\Exception\IO\Output\TargetDirectoryNotWritableException
10296
* @throws \Exception
10397
*/
10498
public function extractTo($destination)
@@ -116,10 +110,10 @@ public function extractTo($destination)
116110
@mkdir($downloadFolder, 0755, true);
117111
}
118112

119-
$distill = new Distill();
120-
if (false == $distill->extract($this->tempnam, $downloadFolder, new Format\Simple\Zip())) {
121-
throw new \Exception('Can not be extract.');
122-
};
113+
(new ZipFile())
114+
->openFile($this->tempnam)
115+
->extractTo($downloadFolder)
116+
;
123117

124118
$filesystem = new Filesystem();
125119
$finder = new Finder();

0 commit comments

Comments
 (0)