diff --git a/README.md b/README.md index be34dbd..ff0b802 100644 --- a/README.md +++ b/README.md @@ -19,3 +19,9 @@ composer require internal/dload -W [![Latest Version on Packagist](https://img.shields.io/packagist/v/internal/dload.svg?style=flat-square&logo=packagist)](https://packagist.org/packages/internal/dload) [![License](https://img.shields.io/packagist/l/internal/dload.svg?style=flat-square)](LICENSE.md) [![Total DLoads](https://img.shields.io/packagist/dt/internal/dload.svg?style=flat-square)](https://packagist.org/packages/internal/dload/stats) + +## Usage + +```bash +./vendor/bin/dload dolt +``` diff --git a/src/Module/Archive/Internal/PharAwareArchive.php b/src/Module/Archive/Internal/PharAwareArchive.php index 5792054..9ccfd66 100644 --- a/src/Module/Archive/Internal/PharAwareArchive.php +++ b/src/Module/Archive/Internal/PharAwareArchive.php @@ -16,7 +16,7 @@ public function __construct(\SplFileInfo $archive) public function extract(): \Generator { - $phar = $this->open($this->archive); + $phar = $this->archive; $phar->isReadable() or throw new \LogicException( \sprintf('Could not open "%s" for reading.', $this->archive->getPathname()), ); diff --git a/src/Module/Common/Architecture.php b/src/Module/Common/Architecture.php index 84e1957..c38b9f1 100644 --- a/src/Module/Common/Architecture.php +++ b/src/Module/Common/Architecture.php @@ -42,7 +42,7 @@ public static function tryFromString(string $arch): ?self public static function tryFromBuildName(string $name): ?self { - if (\preg_match('/\b(amd64|arm64|aarch64|x86_64|x64|x86)\b/i', $name, $matches) !== 1) { + if (\preg_match('/(?:\b|_)(amd64|arm64|aarch64|x86_64|x64|x86)(?:\b|_)/i', $name, $matches) !== 1) { return null; } diff --git a/src/Module/Common/OperatingSystem.php b/src/Module/Common/OperatingSystem.php index a216b87..d610665 100644 --- a/src/Module/Common/OperatingSystem.php +++ b/src/Module/Common/OperatingSystem.php @@ -49,7 +49,7 @@ public static function tryFromString(string $name): ?self public static function tryFromBuildName(string $name): ?self { - if (\preg_match('/\b(windows|linux|darwin|alpine|bsd|freebsd)\b/i', $name, $matches) !== 1) { + if (\preg_match('/(?:\b|_)(windows|linux|darwin|alpine|bsd|freebsd)(?:\b|_)/i', $name, $matches) !== 1) { return null; } diff --git a/src/Module/Downloader/Downloader.php b/src/Module/Downloader/Downloader.php index 3bbcbdf..23c3e06 100644 --- a/src/Module/Downloader/Downloader.php +++ b/src/Module/Downloader/Downloader.php @@ -69,7 +69,6 @@ public function download( ); } catch (\Throwable $e) { $this->logger->exception($e); - yield; goto start; } finally { $repository instanceof Destroyable and $repository->destroy(); diff --git a/src/Module/Repository/Internal/ReleasesCollection.php b/src/Module/Repository/Internal/ReleasesCollection.php index 09ee9ec..2e399c1 100644 --- a/src/Module/Repository/Internal/ReleasesCollection.php +++ b/src/Module/Repository/Internal/ReleasesCollection.php @@ -123,6 +123,10 @@ private function comparisonVersionString(ReleaseInterface $release): string { $stability = $release->getStability(); - return \str_replace('-' . $stability->value, '.' . $stability->getWeight() . '.', $release->getVersion()); + return \ltrim(\str_replace( + '-' . $stability->value, + '.' . $stability->getWeight() . '.', + $release->getVersion(), + ), 'v'); } } diff --git a/tests/Unit/Module/Common/ArchitectureTest.php b/tests/Unit/Module/Common/ArchitectureTest.php new file mode 100644 index 0000000..128fd43 --- /dev/null +++ b/tests/Unit/Module/Common/ArchitectureTest.php @@ -0,0 +1,27 @@ +