Add support for expect and ssh2 using shivammathur/extensions on macOS

Add config to brew extensions and refactor add_brew_extension in darwin.sh to use it
This commit is contained in:
Shivam Mathur 2021-09-28 01:38:12 +05:30
parent 5588437714
commit ab12e42197
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
5 changed files with 36 additions and 5 deletions

View File

@ -73,12 +73,13 @@ describe('Extension tests', () => {
it('checking addExtensionOnDarwin', async () => { it('checking addExtensionOnDarwin', async () => {
let darwin: string = await extensions.addExtension( let darwin: string = await extensions.addExtension(
'Xdebug, pcov, grpc, igbinary, imagick, phalcon3, phalcon4, protobuf, psr, rdkafka, swoole, vips, sqlite, ast-beta', 'Xdebug, pcov, expect, grpc, igbinary, imagick, phalcon3, phalcon4, protobuf, psr, rdkafka, ssh2, swoole, vips, sqlite, ast-beta',
'7.2', '7.2',
'darwin' 'darwin'
); );
expect(darwin).toContain('add_brew_extension xdebug'); expect(darwin).toContain('add_brew_extension xdebug');
expect(darwin).toContain('add_brew_extension pcov'); expect(darwin).toContain('add_brew_extension pcov');
expect(darwin).toContain('add_brew_extension expect');
expect(darwin).toContain('add_brew_extension grpc'); expect(darwin).toContain('add_brew_extension grpc');
expect(darwin).toContain('add_brew_extension igbinary'); expect(darwin).toContain('add_brew_extension igbinary');
expect(darwin).toContain('add_brew_extension imagick'); expect(darwin).toContain('add_brew_extension imagick');
@ -87,6 +88,7 @@ describe('Extension tests', () => {
expect(darwin).toContain('add_brew_extension protobuf'); expect(darwin).toContain('add_brew_extension protobuf');
expect(darwin).toContain('add_brew_extension psr'); expect(darwin).toContain('add_brew_extension psr');
expect(darwin).toContain('add_brew_extension rdkafka'); expect(darwin).toContain('add_brew_extension rdkafka');
expect(darwin).toContain('add_brew_extension ssh2');
expect(darwin).toContain('add_brew_extension swoole'); expect(darwin).toContain('add_brew_extension swoole');
expect(darwin).toContain('add_brew_extension vips'); expect(darwin).toContain('add_brew_extension vips');
expect(darwin).toContain('pecl_install sqlite3'); expect(darwin).toContain('pecl_install sqlite3');

2
dist/index.js vendored
View File

@ -230,7 +230,7 @@ async function addExtensionDarwin(extension_csv, version) {
' ' + ' ' +
ext_prefix; ext_prefix;
return; return;
case /(5\.6|7\.[0-4]|8.0)(amqp|grpc|igbinary|imagick|imap|mongodb|msgpack|^(pecl_)?http$|propro|protobuf|psr|raphf|rdkafka|redis|swoole|xdebug|xdebug2|yaml|zmq)/.test(version_extension): case /(5\.6|7\.[0-4]|8.0)(amqp|expect|grpc|igbinary|imagick|imap|mongodb|msgpack|^(pecl_)?http$|propro|protobuf|psr|raphf|rdkafka|redis|ssh2|swoole|xdebug|xdebug2|yaml|zmq)/.test(version_extension):
case /(7\.[1-4]|8\.0])pcov/.test(version_extension): case /(7\.[1-4]|8\.0])pcov/.test(version_extension):
case /^(5\.6|7\.[0-3])phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension): case /^(5\.6|7\.[0-3])phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
case /(7\.[0-4]|8\.0])vips/.test(version_extension): case /(7\.[0-4]|8\.0])vips/.test(version_extension):

View File

@ -0,0 +1,28 @@
amqp=amqp
apcu=apcu
expect=expect
grpc=grpc
igbinary=igbinary
imagick=imagick
imap=imap
memcache=memcache
memcached=memcached
mongodb=mongodb
msgpack=msgpack
pcov=pcov
pecl_http=http
phalcon3=phalcon
phalcon4=phalcon
propro=propro
protobuf=protobuf
psr=psr
raphf=raphf
rdkafka=rdkafka
redis=redis
ssh2=ssh2
swoole=swoole
vips=vips
xdebug=xdebug
xdebug2=xdebug
yaml=yaml
zmq=zmq

View File

@ -30,10 +30,10 @@ export async function addExtensionDarwin(
' ' + ' ' +
ext_prefix; ext_prefix;
return; return;
// match 5.6 to 8.0 amqp, grpc, igbinary, imagick, imap, mongodb, msgpack, pecl_http, propro, protobuf, raphf, rdkafka, redis, swoole, xdebug, xdebug2, yaml, zmq // match 5.6 to 8.0 amqp, expect, grpc, igbinary, imagick, imap, mongodb, msgpack, pecl_http, propro, protobuf, raphf, rdkafka, redis, ssh2, swoole, xdebug, xdebug2, yaml, zmq
// match 7.1pcov to 8.0pcov // match 7.1pcov to 8.0pcov
// match 7.0vips to 8.0vips // match 7.0vips to 8.0vips
case /(5\.6|7\.[0-4]|8.0)(amqp|grpc|igbinary|imagick|imap|mongodb|msgpack|^(pecl_)?http$|propro|protobuf|psr|raphf|rdkafka|redis|swoole|xdebug|xdebug2|yaml|zmq)/.test( case /(5\.6|7\.[0-4]|8.0)(amqp|expect|grpc|igbinary|imagick|imap|mongodb|msgpack|^(pecl_)?http$|propro|protobuf|psr|raphf|rdkafka|redis|ssh2|swoole|xdebug|xdebug2|yaml|zmq)/.test(
version_extension version_extension
): ):
case /(7\.[1-4]|8\.0])pcov/.test(version_extension): case /(7\.[1-4]|8\.0])pcov/.test(version_extension):

View File

@ -103,7 +103,8 @@ add_brew_tap() {
# Function to install a php extension from shivammathur/extensions tap. # Function to install a php extension from shivammathur/extensions tap.
add_brew_extension() { add_brew_extension() {
formula=$1 formula=$1
extension=${formula//[0-9]/} extension=$(grep "$formula=" "$dist"/../src/configs/brew_extensions | cut -d '=' -f 2)
[[ -z "$extension" ]] && extension="$(echo "$formula" | sed -E "s/pecl_|[0-9]//g")"
add_brew_tap shivammathur/homebrew-php add_brew_tap shivammathur/homebrew-php
add_brew_tap shivammathur/homebrew-extensions add_brew_tap shivammathur/homebrew-extensions
sudo mv "$tap_dir"/shivammathur/homebrew-extensions/.github/deps/"$formula"/* "$tap_dir/homebrew/homebrew-core/Formula/" 2>/dev/null || true sudo mv "$tap_dir"/shivammathur/homebrew-extensions/.github/deps/"$formula"/* "$tap_dir/homebrew/homebrew-core/Formula/" 2>/dev/null || true