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', () => { describe('Extension tests', () => {
it('checking addExtensionOnWindows', async () => { it('checking addExtensionOnWindows', async () => {
let win32: string = await extensions.addExtension( let win32: string = await extensions.addExtension(
'xdebug, pcov', 'xdebug, pcov, redis',
'7.2', '7.4',
'win32' 'win32'
); );
expect(win32).toContain('Add-Extension xdebug'); expect(win32).toContain('Add-Extension xdebug');
expect(win32).toContain('Add-Extension pcov'); expect(win32).toContain('Add-Extension pcov');
win32 = await extensions.addExtension('xdebug, pcov', '7.4', 'win32'); expect(win32).toContain('Add-Extension redis beta');
expect(win32).toContain('Add-Extension xdebug');
win32 = await extensions.addExtension( win32 = await extensions.addExtension(
'does_not_exist', 'does_not_exist',
@ -26,18 +25,21 @@ describe('Extension tests', () => {
it('checking addExtensionOnLinux', async () => { it('checking addExtensionOnLinux', async () => {
let linux: string = await extensions.addExtension( let linux: string = await extensions.addExtension(
'xdebug, pcov', 'xdebug, pcov, redis',
'7.2', '7.4',
'linux' 'linux'
); );
expect(linux).toContain( 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('pecl install xdebug');
expect(linux).toContain( 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('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'); linux = await extensions.addExtension('phalcon3, phalcon4', '7.2', 'linux');
expect(linux).toContain('phalcon.sh master 7.2'); 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 master 7.3');
expect(linux).toContain('phalcon.sh 4.0.x 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'); linux = await extensions.addExtension('xdebug', '7.2', 'fedora');
expect(linux).toContain('Platform fedora is not supported'); expect(linux).toContain('Platform fedora is not supported');
}); });
@ -72,6 +77,12 @@ describe('Extension tests', () => {
darwin = await extensions.addExtension('xdebug', '7.2', 'darwin'); darwin = await extensions.addExtension('xdebug', '7.2', 'darwin');
expect(darwin).toContain('sudo pecl install xdebug'); 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( darwin = await extensions.addExtension(
'does_not_exist', 'does_not_exist',
'7.2', '7.2',

14
dist/index.js vendored
View File

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

28
package-lock.json generated
View File

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

View File

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