From 0da976ee95d64886959ce309b6c40975af9f2945 Mon Sep 17 00:00:00 2001 From: huangzhhui Date: Tue, 11 Oct 2022 20:12:33 +0800 Subject: [PATCH] Support swoole-cli-macos --- pkgs.json | 3 ++- src/app/DownloadHandler/SwooleCliHandler.php | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pkgs.json b/pkgs.json index c8f92da..bd499a9 100644 --- a/pkgs.json +++ b/pkgs.json @@ -94,7 +94,8 @@ "latest": "v5.0.0", "release_asset_keyword": "swoole-cli", "release_asset_match_rule": { - "Linux": "swoole-cli-${{version}}-linux-x64.tar.xz" + "Linux": "swoole-cli-${{version}}-linux-x64.tar.xz", + "Darwin": "swoole-cli-${{version}}-macos-x64.tar.gz" } } } \ No newline at end of file diff --git a/src/app/DownloadHandler/SwooleCliHandler.php b/src/app/DownloadHandler/SwooleCliHandler.php index c709292..0b864e6 100644 --- a/src/app/DownloadHandler/SwooleCliHandler.php +++ b/src/app/DownloadHandler/SwooleCliHandler.php @@ -70,6 +70,13 @@ public function handle(string $pkgName, string $version, array $options = []): ? $this->logger->info('Unpacked tar.xz file ' . $savePath); unlink($file->getRealPath()); } + // Is file name ends with .tar.gz? + if (str_ends_with($file->getFilename(), '.tar.gz')) { + $this->logger->info('Unpacking tar.gz file ' . $savePath); + exec(sprintf('tar -xvf %s -C %s', $file->getRealPath(), $savePath)); + $this->logger->info('Unpacked tar.gz file ' . $savePath); + unlink($file->getRealPath()); + } $licenseFile = $savePath . 'LICENSE'; // If license file exists, delete it. if (file_exists($licenseFile)) {