mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 11:51:07 +07:00
Add support for imagick and igbinary on macOS using shivammathur/homebrew-extensions
This commit is contained in:
parent
ee05ca54f6
commit
74cdfb97c1
@ -78,13 +78,15 @@ describe('Extension tests', () => {
|
||||
|
||||
it('checking addExtensionOnDarwin', async () => {
|
||||
let darwin: string = await extensions.addExtension(
|
||||
'Xdebug, pcov, grpc, protobuf, swoole, sqlite, ast-beta',
|
||||
'Xdebug, pcov, grpc, igbinary, imagick, protobuf, swoole, sqlite, ast-beta',
|
||||
'7.2',
|
||||
'darwin'
|
||||
);
|
||||
expect(darwin).toContain('add_brew_extension xdebug');
|
||||
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');
|
||||
@ -117,14 +119,6 @@ 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');
|
||||
expect(darwin).toContain('brew install pkg-config imagemagick');
|
||||
expect(darwin).toContain('pecl_install imagick');
|
||||
|
||||
darwin = await extensions.addExtension(
|
||||
'does_not_exist',
|
||||
'7.2',
|
||||
|
25
dist/index.js
vendored
25
dist/index.js
vendored
@ -2698,9 +2698,8 @@ const utils = __importStar(__webpack_require__(163));
|
||||
*
|
||||
* @param extension_csv
|
||||
* @param version
|
||||
* @param pipe
|
||||
*/
|
||||
async function addExtensionDarwin(extension_csv, version, pipe) {
|
||||
async function addExtensionDarwin(extension_csv, version) {
|
||||
const extensions = await utils.extensionArray(extension_csv);
|
||||
let script = '\n';
|
||||
await utils.asyncForEach(extensions, async function (extension) {
|
||||
@ -2720,28 +2719,18 @@ async function addExtensionDarwin(extension_csv, version, pipe) {
|
||||
' ' +
|
||||
ext_prefix;
|
||||
return;
|
||||
// match 5.6xdebug to 8.0xdebug, 5.6swoole to 8.0swoole
|
||||
// match 5.6grpc to 7.4grpc, 5.6protobuf to 7.4protobuf
|
||||
// match 5.6xdebug to 8.0xdebug, 5.6igbinary to 8.0igbinary
|
||||
// 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.0pcov
|
||||
case /(5\.6|7\.[0-4]|8\.[0-9])xdebug/.test(version_extension):
|
||||
case /(5\.6|7\.[0-4])(grpc|protobuf|swoole)/.test(version_extension):
|
||||
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
|
||||
case /(5\.6|7\.[0-4]|8\.0)(xdebug|igbinary)/.test(version_extension):
|
||||
case /(5\.6|7\.[0-4])(grpc|imagick|protobuf|swoole)/.test(version_extension):
|
||||
case /(7\.[1-4]|8\.0])pcov/.test(version_extension):
|
||||
command = 'add_brew_extension ' + extension_name;
|
||||
break;
|
||||
// match 5.6redis
|
||||
case /5\.6redis/.test(version_extension):
|
||||
command = command_prefix + 'redis-2.2.8';
|
||||
break;
|
||||
// match imagick
|
||||
case /^imagick$/.test(extension):
|
||||
command =
|
||||
'brew install pkg-config imagemagick' +
|
||||
pipe +
|
||||
' && ' +
|
||||
command_prefix +
|
||||
'imagick' +
|
||||
pipe;
|
||||
break;
|
||||
// match sqlite
|
||||
case /^sqlite$/.test(extension):
|
||||
extension = 'sqlite3';
|
||||
@ -2914,7 +2903,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, pipe));
|
||||
return script + (await addExtensionDarwin(extension_csv, version));
|
||||
case 'linux':
|
||||
return script + (await addExtensionLinux(extension_csv, version, pipe));
|
||||
default:
|
||||
|
@ -6,12 +6,10 @@ import * as utils from './utils';
|
||||
*
|
||||
* @param extension_csv
|
||||
* @param version
|
||||
* @param pipe
|
||||
*/
|
||||
export async function addExtensionDarwin(
|
||||
extension_csv: string,
|
||||
version: string,
|
||||
pipe: string
|
||||
version: string
|
||||
): Promise<string> {
|
||||
const extensions: Array<string> = await utils.extensionArray(extension_csv);
|
||||
let script = '\n';
|
||||
@ -32,28 +30,20 @@ export async function addExtensionDarwin(
|
||||
' ' +
|
||||
ext_prefix;
|
||||
return;
|
||||
// match 5.6xdebug to 8.0xdebug, 5.6swoole to 8.0swoole
|
||||
// match 5.6grpc to 7.4grpc, 5.6protobuf to 7.4protobuf
|
||||
// match 5.6xdebug to 8.0xdebug, 5.6igbinary to 8.0igbinary
|
||||
// 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.0pcov
|
||||
case /(5\.6|7\.[0-4]|8\.[0-9])xdebug/.test(version_extension):
|
||||
case /(5\.6|7\.[0-4])(grpc|protobuf|swoole)/.test(version_extension):
|
||||
case /(7\.[1-4]|8\.[0-9])pcov/.test(version_extension):
|
||||
case /(5\.6|7\.[0-4]|8\.0)(xdebug|igbinary)/.test(version_extension):
|
||||
case /(5\.6|7\.[0-4])(grpc|imagick|protobuf|swoole)/.test(
|
||||
version_extension
|
||||
):
|
||||
case /(7\.[1-4]|8\.0])pcov/.test(version_extension):
|
||||
command = 'add_brew_extension ' + extension_name;
|
||||
break;
|
||||
// match 5.6redis
|
||||
case /5\.6redis/.test(version_extension):
|
||||
command = command_prefix + 'redis-2.2.8';
|
||||
break;
|
||||
// match imagick
|
||||
case /^imagick$/.test(extension):
|
||||
command =
|
||||
'brew install pkg-config imagemagick' +
|
||||
pipe +
|
||||
' && ' +
|
||||
command_prefix +
|
||||
'imagick' +
|
||||
pipe;
|
||||
break;
|
||||
// match sqlite
|
||||
case /^sqlite$/.test(extension):
|
||||
extension = 'sqlite3';
|
||||
@ -239,7 +229,7 @@ export async function addExtension(
|
||||
case 'win32':
|
||||
return script + (await addExtensionWindows(extension_csv, version));
|
||||
case 'darwin':
|
||||
return script + (await addExtensionDarwin(extension_csv, version, pipe));
|
||||
return script + (await addExtensionDarwin(extension_csv, version));
|
||||
case 'linux':
|
||||
return script + (await addExtensionLinux(extension_csv, version, pipe));
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user