From d2f333de6fc6948cd48f5e513fbce3872403450b Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Tue, 13 Jun 2023 03:16:19 +0530 Subject: [PATCH] Fix regression in major/minor.major version support for phpunit --- dist/index.js | 3 ++- src/configs/tools.json | 3 ++- src/configs/tools_schema.json | 10 ++++++++++ src/tools.ts | 3 ++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/dist/index.js b/dist/index.js index 114b08a5..758ab883 100644 --- a/dist/index.js +++ b/dist/index.js @@ -946,7 +946,7 @@ exports.addPhive = addPhive; async function addPHPUnitTools(data) { if (data['version'] === 'latest') { data['version'] = - (await packagist.search(data['repository'], data['php_version'])) ?? + (await packagist.search(data['packagist'], data['php_version'])) ?? 'latest'; } data['url'] = await getPharUrl(data); @@ -1000,6 +1000,7 @@ async function getData(release, php_version, os) { data['extension'] ??= '.phar'; data['os'] = os; data['php_version'] = php_version; + data['packagist'] ??= data['repository']; data['prefix'] = data['github'] === data['domain'] ? 'releases' : ''; data['verb'] = data['github'] === data['domain'] ? 'download' : ''; data['fetch_latest'] ??= 'false'; diff --git a/src/configs/tools.json b/src/configs/tools.json index b3969a7d..0833ae5d 100644 --- a/src/configs/tools.json +++ b/src/configs/tools.json @@ -267,7 +267,8 @@ }, "phpunit": { "type": "custom-function", - "repository": "phpunit/phpunit", + "repository": "sebastianbergmann/phpunit", + "packagist": "phpunit/phpunit", "domain": "https://phar.phpunit.de", "function": "phpunit", "version_prefix": "", diff --git a/src/configs/tools_schema.json b/src/configs/tools_schema.json index e0238cdc..a85d3086 100644 --- a/src/configs/tools_schema.json +++ b/src/configs/tools_schema.json @@ -13,6 +13,7 @@ "fetch_latest": "true", "function": "function_name", "repository": "user/tool", + "packagist": "user/tool", "scope": "global, scoped", "type": "phar, composer, custom-package or custom-function", "version_parameter": "--version", @@ -77,6 +78,15 @@ "user/tool" ] }, + "packagist": { + "$id": "#/items/properties/packagist", + "type": "string", + "title": "The repository schema", + "description": "Packagist repository of the tool in case different from repository.", + "examples": [ + "user/tool" + ] + }, "scope": { "$id": "#/items/properties/scope", "type": "string", diff --git a/src/tools.ts b/src/tools.ts index d9d1295a..ba923f6a 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -395,7 +395,7 @@ export async function addPhive(data: RS): Promise { export async function addPHPUnitTools(data: RS): Promise { if (data['version'] === 'latest') { data['version'] = - (await packagist.search(data['repository'], data['php_version'])) ?? + (await packagist.search(data['packagist'], data['php_version'])) ?? 'latest'; } data['url'] = await getPharUrl(data); @@ -464,6 +464,7 @@ export async function getData( data['extension'] ??= '.phar'; data['os'] = os; data['php_version'] = php_version; + data['packagist'] ??= data['repository']; data['prefix'] = data['github'] === data['domain'] ? 'releases' : ''; data['verb'] = data['github'] === data['domain'] ? 'download' : ''; data['fetch_latest'] ??= 'false';