Add support for ext-gearman. Closes #116

This commit is contained in:
Shivam Mathur 2019-12-14 08:15:39 +05:30
parent 87e6c70743
commit 8f8207a1ca
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
4 changed files with 52 additions and 3 deletions

View File

@ -41,16 +41,32 @@ describe('Extension tests', () => {
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-igbinary php7.4-redis' '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('gearman', '7.0', 'linux');
expect(linux).toContain('gearman.sh 7.0');
linux = await extensions.addExtension('gearman', '7.1', 'linux');
expect(linux).toContain('gearman.sh 7.1');
linux = await extensions.addExtension(
'phalcon3, phalcon4, gearman',
'7.2',
'linux'
);
expect(linux).toContain('phalcon.sh master 7.2'); expect(linux).toContain('phalcon.sh master 7.2');
expect(linux).toContain('phalcon.sh 4.0.x 7.2'); expect(linux).toContain('phalcon.sh 4.0.x 7.2');
expect(linux).toContain('gearman.sh 7.2');
linux = await extensions.addExtension('phalcon3, phalcon4', '7.3', 'linux'); linux = await extensions.addExtension(
'phalcon3, phalcon4, gearman',
'7.3',
'linux'
);
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');
expect(linux).toContain('gearman.sh 7.3');
linux = await extensions.addExtension('phalcon4', '7.4', 'linux'); linux = await extensions.addExtension('phalcon4, gearman', '7.4', 'linux');
expect(linux).toContain('phalcon.sh 4.0.x 7.4'); expect(linux).toContain('phalcon.sh 4.0.x 7.4');
expect(linux).toContain('gearman.sh 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');

12
dist/index.js vendored
View File

@ -2208,6 +2208,18 @@ function addExtensionLinux(extension_csv, version) {
version + version +
' >/dev/null 2>&1'; ' >/dev/null 2>&1';
break; break;
case '7.0gearman':
case '7.1gearman':
case '7.2gearman':
case '7.3gearman':
case '7.4gearman':
install_command =
'sh ' +
path.join(__dirname, '../src/scripts/gearman.sh') +
' ' +
version +
' >/dev/null 2>&1';
break;
default: default:
install_command = install_command =
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' + 'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' +

View File

@ -106,6 +106,18 @@ export async function addExtensionLinux(
version + version +
' >/dev/null 2>&1'; ' >/dev/null 2>&1';
break; break;
case '7.0gearman':
case '7.1gearman':
case '7.2gearman':
case '7.3gearman':
case '7.4gearman':
install_command =
'sh ' +
path.join(__dirname, '../src/scripts/gearman.sh') +
' ' +
version +
' >/dev/null 2>&1';
break;
default: default:
install_command = install_command =
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' + 'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' +

9
src/scripts/gearman.sh Normal file
View File

@ -0,0 +1,9 @@
release_version=$(lsb_release -s -r)
sudo DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:ondrej/pkg-gearman -y
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
if [ "$release_version" = "18.04" ]; then
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y libgearman-dev php"$1"-gearman
elif [ "$release_version" = "16.04" ]; then
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$1"-gearman
fi