Fix ext-redis

This commit is contained in:
Shivam Mathur 2019-12-02 20:43:45 +05:30
parent 8d8c2bd524
commit 914c51cfb6
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
4 changed files with 70 additions and 17 deletions

View File

@ -3,14 +3,13 @@ import * as extensions from '../src/extensions';
describe('Extension tests', () => {
it('checking addExtensionOnWindows', async () => {
let win32: string = await extensions.addExtension(
'xdebug, pcov',
'7.2',
'xdebug, pcov, redis',
'7.4',
'win32'
);
expect(win32).toContain('Add-Extension xdebug');
expect(win32).toContain('Add-Extension pcov');
win32 = await extensions.addExtension('xdebug, pcov', '7.4', 'win32');
expect(win32).toContain('Add-Extension xdebug');
expect(win32).toContain('Add-Extension redis beta');
win32 = await extensions.addExtension(
'does_not_exist',
@ -26,18 +25,21 @@ describe('Extension tests', () => {
it('checking addExtensionOnLinux', async () => {
let linux: string = await extensions.addExtension(
'xdebug, pcov',
'7.2',
'xdebug, pcov, redis',
'7.4',
'linux'
);
expect(linux).toContain(
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.2-xdebug'
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-xdebug'
);
expect(linux).toContain('pecl install xdebug');
expect(linux).toContain(
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.2-pcov'
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-pcov'
);
expect(linux).toContain('pecl install pcov');
expect(linux).toContain(
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-igbinary php7.4-redis'
);
linux = await extensions.addExtension('phalcon3, phalcon4', '7.2', 'linux');
expect(linux).toContain('phalcon.sh master 7.2');
@ -47,6 +49,9 @@ describe('Extension tests', () => {
expect(linux).toContain('phalcon.sh master 7.3');
expect(linux).toContain('phalcon.sh 4.0.x 7.3');
linux = await extensions.addExtension('phalcon4', '7.4', 'linux');
expect(linux).toContain('phalcon.sh 4.0.x 7.4');
linux = await extensions.addExtension('xdebug', '7.2', 'fedora');
expect(linux).toContain('Platform fedora is not supported');
});
@ -72,6 +77,12 @@ describe('Extension tests', () => {
darwin = await extensions.addExtension('xdebug', '7.2', 'darwin');
expect(darwin).toContain('sudo pecl install xdebug');
darwin = await extensions.addExtension('redis', '5.6', 'darwin');
expect(darwin).toContain('sudo pecl install redis-2.2.8');
darwin = await extensions.addExtension('redis', '7.2', 'darwin');
expect(darwin).toContain('sudo pecl install redis');
darwin = await extensions.addExtension(
'does_not_exist',
'7.2',

16
dist/index.js vendored
View File

@ -1607,6 +1607,9 @@ function addExtensionDarwin(extension_csv, version) {
case '5.6xdebug':
install_command = 'sudo pecl install xdebug-2.5.5 >/dev/null 2>&1';
break;
case '5.6redis':
install_command = 'sudo pecl install redis-2.2.8 >/dev/null 2>&1';
break;
default:
install_command = 'sudo pecl install ' + extension + ' >/dev/null 2>&1';
break;
@ -1637,7 +1640,14 @@ function addExtensionWindows(extension_csv, version) {
yield utils.asyncForEach(extensions, function (extension) {
return __awaiter(this, void 0, void 0, function* () {
// add script to enable extension is already installed along with php
script += '\nAdd-Extension ' + extension;
switch (version + extension) {
case '7.4redis':
script += '\nAdd-Extension ' + extension + ' beta';
break;
default:
script += '\nAdd-Extension ' + extension;
break;
}
});
});
return script;
@ -1660,6 +1670,10 @@ function addExtensionLinux(extension_csv, version) {
// add script to enable extension is already installed along with php
let install_command = '';
switch (version + extension) {
case '7.4redis':
install_command =
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-igbinary php7.4-redis >/dev/null 2>&1';
break;
case '7.2phalcon3':
case '7.3phalcon3':
install_command =

28
package-lock.json generated
View File

@ -2249,12 +2249,14 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -2269,17 +2271,20 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
@ -2396,7 +2401,8 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"ini": {
"version": "1.3.5",
@ -2408,6 +2414,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -2422,6 +2429,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@ -2429,12 +2437,14 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@ -2453,6 +2463,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -2533,7 +2544,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
@ -2545,6 +2557,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -2666,6 +2679,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",

View File

@ -21,6 +21,9 @@ export async function addExtensionDarwin(
case '5.6xdebug':
install_command = 'sudo pecl install xdebug-2.5.5 >/dev/null 2>&1';
break;
case '5.6redis':
install_command = 'sudo pecl install redis-2.2.8 >/dev/null 2>&1';
break;
default:
install_command = 'sudo pecl install ' + extension + ' >/dev/null 2>&1';
break;
@ -50,7 +53,14 @@ export async function addExtensionWindows(
let script = '\n';
await utils.asyncForEach(extensions, async function(extension: string) {
// add script to enable extension is already installed along with php
script += '\nAdd-Extension ' + extension;
switch (version + extension) {
case '7.4redis':
script += '\nAdd-Extension ' + extension + ' beta';
break;
default:
script += '\nAdd-Extension ' + extension;
break;
}
});
return script;
}
@ -73,6 +83,10 @@ export async function addExtensionLinux(
let install_command = '';
switch (version + extension) {
case '7.4redis':
install_command =
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-igbinary php7.4-redis >/dev/null 2>&1';
break;
case '7.2phalcon3':
case '7.3phalcon3':
install_command =