Skip to content

Commit

Permalink
feat: add tigerbeetle in the registry
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed Aug 2, 2024
1 parent 0539993 commit ea5e817
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
18 changes: 18 additions & 0 deletions resources/software.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,23 @@
"pattern": "/^(protoc)(?:\\.exe)?$/"
}
]
},
{
"name": "TigerBeetle ",
"alias": "tigerbeetle",
"description": "TigerBeetle is a financial transactions database designed for mission critical safety and performance to power the next 30 years of OLTP.",
"homepage": "https://tigerbeetle.com/",
"repositories": [
{
"type": "github",
"uri": "tigerbeetle/tigerbeetle",
"asset-pattern": "/^tigerbeetle-.*/"
}
],
"files": [
{
"pattern": "/^(tigerbeetle)(?:\\.exe)?$/"
}
]
}
]
13 changes: 7 additions & 6 deletions src/Module/Repository/Internal/GitHub/GitHubRelease.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
* @psalm-import-type GitHubAssetApiResponse from GitHubAsset
*
* @psalm-type GitHubReleaseApiResponse = array{
* name: non-empty-string,
* name: string|null,
* tag-name: string|null,
* assets: array<array-key, GitHubAssetApiResponse>
* }
*
Expand All @@ -42,12 +43,12 @@ public function __construct(
*/
public static function fromApiResponse(GitHubRepository $repository, HttpClientInterface $client, array $data): self
{
isset($data['name']) or throw new \InvalidArgumentException(
'Passed array must contain "name" value of type string.',
isset($data['tag_name']) || isset($data['name']) or throw new \InvalidArgumentException(
'Passed array must contain "tag_name" value of type string.',
);

$name = self::getTagName($data);
$version = $data['tag_name'] ?? $data['name'];
$version = $data['tag_name'] ?? (string)$data['name'];
$result = new self($client, $repository, $name, $version);

$result->assets = AssetsCollection::from(static function () use ($client, $result, $data): \Generator {
Expand Down Expand Up @@ -87,7 +88,7 @@ public function destroy(): void
*
* @note The return value is "pretty", but that does not mean that the tag physically exists.
*
* @param array{tag_name: string, name: string} $data
* @param array{tag_name: string|null, name: string|null} $data
* @return string
*/
private static function getTagName(array $data): string
Expand All @@ -98,7 +99,7 @@ private static function getTagName(array $data): string
return $parser->normalize($data['tag_name']);
} catch (\Throwable $e) {
try {
return $parser->normalize($data['name']);
return $parser->normalize((string)$data['name']);
} catch (\Throwable $e) {
return 'dev-' . $data['tag_name'];
}
Expand Down

0 comments on commit ea5e817

Please sign in to comment.