diff --git a/__tests__/extensions.test.ts b/__tests__/extensions.test.ts index dd52cc62..fbb0c4f9 100644 --- a/__tests__/extensions.test.ts +++ b/__tests__/extensions.test.ts @@ -129,7 +129,7 @@ describe('Extension tests', () => { it('checking addExtensionOnDarwin', async () => { let darwin: string = await extensions.addExtension( - 'Xdebug, pcov, grpc, igbinary, protobuf, swoole, sqlite, oci8, pdo_oci, :intl, ast-beta, grpc-1.2.3', + 'Xdebug, pcov, grpc, igbinary, imagick, protobuf, swoole, sqlite, oci8, pdo_oci, :intl, ast-beta, grpc-1.2.3', '7.2', 'darwin' ); @@ -137,6 +137,7 @@ describe('Extension tests', () => { expect(darwin).toContain('add_brew_extension pcov'); expect(darwin).toContain('add_brew_extension grpc'); expect(darwin).toContain('add_brew_extension igbinary'); + expect(darwin).toContain('add_brew_extension imagick'); expect(darwin).toContain('add_brew_extension protobuf'); expect(darwin).toContain('add_brew_extension swoole'); expect(darwin).toContain('pecl_install sqlite3'); @@ -180,11 +181,7 @@ describe('Extension tests', () => { darwin = await extensions.addExtension('redis', '7.2', 'darwin'); expect(darwin).toContain('pecl_install redis'); - darwin = await extensions.addExtension('imagick', '5.6', 'darwin'); - expect(darwin).toContain('brew install pkg-config imagemagick'); - expect(darwin).toContain('pecl_install imagick'); - - darwin = await extensions.addExtension('imagick', '7.4', 'darwin'); + darwin = await extensions.addExtension('imagick', '5.5', 'darwin'); expect(darwin).toContain('brew install pkg-config imagemagick'); expect(darwin).toContain('pecl_install imagick'); diff --git a/dist/index.js b/dist/index.js index d361b6d6..d4ab418a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2845,8 +2845,9 @@ const utils = __importStar(__webpack_require__(163)); * * @param extension_csv * @param version + * @param pipe */ -async function addExtensionDarwin(extension_csv, version) { +async function addExtensionDarwin(extension_csv, version, pipe) { const extensions = await utils.extensionArray(extension_csv); let add_script = '\n'; let remove_script = ''; @@ -2885,10 +2886,10 @@ async function addExtensionDarwin(extension_csv, version) { add_script += await utils.getUnsupportedLog('pcov', version, 'darwin'); return; // match 5.6xdebug to 8.9xdebug, 5.6igbinary to 8.9igbinary - // match 5.6grpc to 7.4grpc, 5.6protobuf to 7.4protobuf, 5.6swoole to 7.4swoole + // match 5.6grpc to 7.4grpc, 5.6imagick to 7.4imagick, 5.6protobuf to 7.4protobuf, 5.6swoole to 7.4swoole // match 7.1pcov to 8.9pcov case /(5\.6|7\.[0-4]|8\.[0-9])(xdebug|igbinary)/.test(version_extension): - case /(5\.6|7\.[0-4])(grpc|protobuf|swoole)/.test(version_extension): + case /(5\.6|7\.[0-4])(grpc|imagick|protobuf|swoole)/.test(version_extension): case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension): command = 'add_brew_extension ' + ext_name; break; @@ -2896,8 +2897,8 @@ async function addExtensionDarwin(extension_csv, version) { case /5\.6redis/.test(version_extension): command = command_prefix + 'redis-2.2.8'; break; - // match imagick - case /^imagick$/.test(extension): + // match 5.4imagick and 5.5imagick + case /^5\.[4-5]imagick$/.test(version_extension): command = await utils.joins('brew install pkg-config imagemagick' + pipe, '&& ' + command_prefix + 'imagick' + pipe); break; // match sqlite @@ -3094,7 +3095,7 @@ async function addExtension(extension_csv, version, os_version, no_step = false) case 'win32': return script + (await addExtensionWindows(extension_csv, version)); case 'darwin': - return script + (await addExtensionDarwin(extension_csv, version)); + return script + (await addExtensionDarwin(extension_csv, version, pipe)); case 'linux': return script + (await addExtensionLinux(extension_csv, version, pipe)); default: diff --git a/src/extensions.ts b/src/extensions.ts index 7c00bc1d..6a346b27 100644 --- a/src/extensions.ts +++ b/src/extensions.ts @@ -5,10 +5,12 @@ import * as utils from './utils'; * * @param extension_csv * @param version + * @param pipe */ export async function addExtensionDarwin( extension_csv: string, - version: string + version: string, + pipe: string ): Promise { const extensions: Array = await utils.extensionArray(extension_csv); let add_script = '\n'; @@ -65,10 +67,12 @@ export async function addExtensionDarwin( add_script += await utils.getUnsupportedLog('pcov', version, 'darwin'); return; // match 5.6xdebug to 8.9xdebug, 5.6igbinary to 8.9igbinary - // match 5.6grpc to 7.4grpc, 5.6protobuf to 7.4protobuf, 5.6swoole to 7.4swoole + // match 5.6grpc to 7.4grpc, 5.6imagick to 7.4imagick, 5.6protobuf to 7.4protobuf, 5.6swoole to 7.4swoole // match 7.1pcov to 8.9pcov case /(5\.6|7\.[0-4]|8\.[0-9])(xdebug|igbinary)/.test(version_extension): - case /(5\.6|7\.[0-4])(grpc|protobuf|swoole)/.test(version_extension): + case /(5\.6|7\.[0-4])(grpc|imagick|protobuf|swoole)/.test( + version_extension + ): case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension): command = 'add_brew_extension ' + ext_name; break; @@ -76,8 +80,8 @@ export async function addExtensionDarwin( case /5\.6redis/.test(version_extension): command = command_prefix + 'redis-2.2.8'; break; - // match imagick - case /^imagick$/.test(extension): + // match 5.4imagick and 5.5imagick + case /^5\.[4-5]imagick$/.test(version_extension): command = await utils.joins( 'brew install pkg-config imagemagick' + pipe, '&& ' + command_prefix + 'imagick' + pipe @@ -346,7 +350,7 @@ export async function addExtension( case 'win32': return script + (await addExtensionWindows(extension_csv, version)); case 'darwin': - return script + (await addExtensionDarwin(extension_csv, version)); + return script + (await addExtensionDarwin(extension_csv, version, pipe)); case 'linux': return script + (await addExtensionLinux(extension_csv, version, pipe)); default: