Merge pull request #201 from shivammathur/develop

2.1.2
This commit is contained in:
Shivam Mathur 2020-03-14 15:29:33 +05:30 committed by GitHub
commit 933abd531a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 1038 additions and 1152 deletions

View File

@ -17,7 +17,6 @@
"camelcase": "off",
"require-atomic-updates": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/no-unused-vars": "off"
"@typescript-eslint/camelcase": "off"
}
}

View File

@ -68,7 +68,7 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|Windows Server 2019|`windows-latest` or `windows-2019`|
|Ubuntu 18.04|`ubuntu-latest` or `ubuntu-18.04`|
|Ubuntu 16.04|`ubuntu-16.04`|
|macOS X Catalina 10.15|`macos-latest` or `macOS-10.15`|
|macOS X Catalina 10.15|`macos-latest` or `macos-10.15`|
## :heavy_plus_sign: PHP Extension Support
- On `ubuntu` by default extensions which are available as a package can be installed. PECL extensions if not available as a package can be installed by specifying `pecl` in the tools input.

View File

@ -3,12 +3,13 @@ import * as extensions from '../src/extensions';
describe('Extension tests', () => {
it('checking addExtensionOnWindows', async () => {
let win32: string = await extensions.addExtension(
'xdebug, pcov, phalcon4, ast-beta, grpc-1.2.3, inotify-1.2.3alpha2',
'Xdebug, pcov, sqlite, phalcon4, ast-beta, grpc-1.2.3, inotify-1.2.3alpha2',
'7.4',
'win32'
);
expect(win32).toContain('Add-Extension xdebug');
expect(win32).toContain('Add-Extension pcov');
expect(win32).toContain('Add-Extension sqlite3');
expect(win32).toContain('phalcon.ps1 phalcon4');
expect(win32).toContain('Add-Extension ast beta');
expect(win32).toContain('Add-Extension grpc stable 1.2.3');
@ -35,12 +36,15 @@ describe('Extension tests', () => {
it('checking addExtensionOnLinux', async () => {
let linux: string = await extensions.addExtension(
'xdebug, pcov, ast-beta, pdo_mysql, pdo-odbc, xdebug-alpha, grpc-1.2.3',
'Xdebug, pcov, sqlite, ast-beta, pdo_mysql, pdo-odbc, xdebug-alpha, grpc-1.2.3',
'7.4',
'linux'
);
expect(linux).toContain('update_extension xdebug 2.9.1');
expect(linux).toContain('update_extension xdebug 2.9.2');
expect(linux).toContain('sudo $debconf_fix apt-get install -y php7.4-pcov');
expect(linux).toContain(
'sudo $debconf_fix apt-get install -y php7.4-sqlite3'
);
expect(linux).toContain('add_unstable_extension ast beta extension');
expect(linux).toContain('add_pdo_extension mysql');
expect(linux).toContain('add_pdo_extension odbc');
@ -79,12 +83,13 @@ describe('Extension tests', () => {
it('checking addExtensionOnDarwin', async () => {
let darwin: string = await extensions.addExtension(
'xdebug, pcov, ast-beta, grpc-1.2.3',
'Xdebug, pcov, sqlite, ast-beta, grpc-1.2.3',
'7.2',
'darwin'
);
expect(darwin).toContain('sudo pecl install -f xdebug');
expect(darwin).toContain('sudo pecl install -f pcov');
expect(darwin).toContain('sudo pecl install -f sqlite3');
expect(darwin).toContain('add_unstable_extension ast beta extension');
expect(darwin).toContain('add_pecl_extension grpc 1.2.3 extension');

View File

@ -1,16 +1,6 @@
import * as io from '@actions/io';
import * as path from 'path';
import * as fs from 'fs';
import * as matchers from '../src/matchers';
async function cleanup(path: string): Promise<void> {
fs.unlink(path, error => {
if (error) {
console.log(error);
}
});
}
jest.mock('@actions/io');
describe('Matchers', () => {

View File

@ -55,12 +55,12 @@ describe('Utils tests', () => {
path.join(__dirname, '../src/scripts/win32.ps1'),
'utf8'
);
expect(await utils.readScript('darwin.sh', '7.4', 'darwin')).toBe(darwin);
expect(await utils.readScript('darwin.sh', '7.3', 'darwin')).toBe(darwin);
expect(await utils.readScript('linux.sh', '7.4', 'linux')).toBe(linux);
expect(await utils.readScript('linux.sh', '7.3', 'linux')).toBe(linux);
expect(await utils.readScript('win32.ps1', '7.4', 'win32')).toBe(win32);
expect(await utils.readScript('win32.ps1', '7.3', 'win32')).toBe(win32);
expect(await utils.readScript('darwin.sh')).toBe(darwin);
expect(await utils.readScript('darwin.sh')).toBe(darwin);
expect(await utils.readScript('linux.sh')).toBe(linux);
expect(await utils.readScript('linux.sh')).toBe(linux);
expect(await utils.readScript('win32.ps1')).toBe(win32);
expect(await utils.readScript('win32.ps1')).toBe(win32);
});
it('checking writeScripts', async () => {

1843
dist/index.js vendored

File diff suppressed because it is too large Load Diff

138
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "setup-php",
"version": "2.1.1",
"version": "2.1.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -69,9 +69,9 @@
}
},
"@babel/generator": {
"version": "7.8.7",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.8.7.tgz",
"integrity": "sha512-DQwjiKJqH4C3qGiyQCAExJHoZssn49JTMJgZ8SANGgVFdkupcUhLOdkAeoC6kmHZCPfoDG5M0b6cFlSN5wW7Ew==",
"version": "7.8.8",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.8.8.tgz",
"integrity": "sha512-HKyUVu69cZoclptr8t8U5b6sx6zoWjh8jiUhnuj3MpZuKT2dJ8zPTuiy31luq32swhI0SpwItCIlU8XW7BZeJg==",
"dev": true,
"requires": {
"@babel/types": "^7.8.7",
@ -198,9 +198,9 @@
}
},
"@babel/parser": {
"version": "7.8.7",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.8.7.tgz",
"integrity": "sha512-9JWls8WilDXFGxs0phaXAZgpxTZhSk/yOYH2hTHC0X1yC7Z78IJfvR1vJ+rmJKq3I35td2XzXzN6ZLYlna+r/A==",
"version": "7.8.8",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.8.8.tgz",
"integrity": "sha512-mO5GWzBPsPf6865iIbzNE0AvkKF3NE+2S3eRUpE+FE07BOAkXh6G+GW/Pj01hhXjve1WScbaIO4UlY1JKeqCcA==",
"dev": true
},
"@babel/plugin-syntax-bigint": {
@ -294,9 +294,9 @@
},
"dependencies": {
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"dev": true
}
}
@ -678,9 +678,9 @@
"dev": true
},
"@types/node": {
"version": "13.9.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.9.0.tgz",
"integrity": "sha512-0ARSQootUG1RljH2HncpsY2TJBfGQIKOOi7kxzUY6z54ePu/ZD+wJA8zI2Q6v8rol2qpG/rvqsReco8zNMPvhQ==",
"version": "13.9.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.9.1.tgz",
"integrity": "sha512-E6M6N0blf/jiZx8Q3nb0vNaswQeEyn0XlupO+xN6DtJ6r6IT4nXrTry7zhIfYvFCl3/8Cu6WIysmUBKiqV0bqQ==",
"dev": true
},
"@types/parse-json": {
@ -711,12 +711,12 @@
"dev": true
},
"@typescript-eslint/eslint-plugin": {
"version": "2.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.22.0.tgz",
"integrity": "sha512-BvxRLaTDVQ3N+Qq8BivLiE9akQLAOUfxNHIEhedOcg8B2+jY8Rc4/D+iVprvuMX1AdezFYautuGDwr9QxqSxBQ==",
"version": "2.23.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.23.0.tgz",
"integrity": "sha512-8iA4FvRsz8qTjR0L/nK9RcRUN3QtIHQiOm69FzV7WS3SE+7P7DyGGwh3k4UNR2JBbk+Ej2Io+jLAaqKibNhmtw==",
"dev": true,
"requires": {
"@typescript-eslint/experimental-utils": "2.22.0",
"@typescript-eslint/experimental-utils": "2.23.0",
"eslint-utils": "^1.4.3",
"functional-red-black-tree": "^1.0.1",
"regexpp": "^3.0.0",
@ -724,32 +724,32 @@
}
},
"@typescript-eslint/experimental-utils": {
"version": "2.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.22.0.tgz",
"integrity": "sha512-sJt1GYBe6yC0dWOQzXlp+tiuGglNhJC9eXZeC8GBVH98Zv9jtatccuhz0OF5kC/DwChqsNfghHx7OlIDQjNYAQ==",
"version": "2.23.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.23.0.tgz",
"integrity": "sha512-OswxY59RcXH3NNPmq+4Kis2CYZPurRU6mG5xPcn24CjFyfdVli5mySwZz/g/xDbJXgDsYqNGq7enV0IziWGXVQ==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.3",
"@typescript-eslint/typescript-estree": "2.22.0",
"@typescript-eslint/typescript-estree": "2.23.0",
"eslint-scope": "^5.0.0"
}
},
"@typescript-eslint/parser": {
"version": "2.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.22.0.tgz",
"integrity": "sha512-FaZKC1X+nvD7qMPqKFUYHz3H0TAioSVFGvG29f796Nc5tBluoqfHgLbSFKsh7mKjRoeTm8J9WX2Wo9EyZWjG7w==",
"version": "2.23.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.23.0.tgz",
"integrity": "sha512-k61pn/Nepk43qa1oLMiyqApC6x5eP5ddPz6VUYXCAuXxbmRLqkPYzkFRKl42ltxzB2luvejlVncrEpflgQoSUg==",
"dev": true,
"requires": {
"@types/eslint-visitor-keys": "^1.0.0",
"@typescript-eslint/experimental-utils": "2.22.0",
"@typescript-eslint/typescript-estree": "2.22.0",
"@typescript-eslint/experimental-utils": "2.23.0",
"@typescript-eslint/typescript-estree": "2.23.0",
"eslint-visitor-keys": "^1.1.0"
}
},
"@typescript-eslint/typescript-estree": {
"version": "2.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.22.0.tgz",
"integrity": "sha512-2HFZW2FQc4MhIBB8WhDm9lVFaBDy6h9jGrJ4V2Uzxe/ON29HCHBTj3GkgcsgMWfsl2U5as+pTOr30Nibaw7qRQ==",
"version": "2.23.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.23.0.tgz",
"integrity": "sha512-pmf7IlmvXdlEXvE/JWNNJpEvwBV59wtJqA8MLAxMKLXNKVRC3HZBXR/SlZLPWTCcwOSg9IM7GeRSV3SIerGVqw==",
"dev": true,
"requires": {
"debug": "^4.1.1",
@ -790,9 +790,9 @@
},
"dependencies": {
"acorn": {
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.0.tgz",
"integrity": "sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw==",
"version": "6.4.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz",
"integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==",
"dev": true
}
}
@ -1926,12 +1926,12 @@
"dev": true
},
"espree": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/espree/-/espree-6.2.0.tgz",
"integrity": "sha512-Xs8airJ7RQolnDIbLtRutmfvSsAe0xqMMAantCN/GMoqf81TFbeI1T7Jpd56qYu1uuh32dOG5W/X9uO+ghPXzA==",
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz",
"integrity": "sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==",
"dev": true,
"requires": {
"acorn": "^7.1.0",
"acorn": "^7.1.1",
"acorn-jsx": "^5.2.0",
"eslint-visitor-keys": "^1.1.0"
}
@ -2395,9 +2395,9 @@
}
},
"globals": {
"version": "12.3.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-12.3.0.tgz",
"integrity": "sha512-wAfjdLgFsPZsklLJvOBUBmzYE8/CwhEqSBEMRXA3qxIiNtyqvjYurAtIfDh6chlEPUfmTY3MnZh5Hfh4q0UlIw==",
"version": "12.4.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz",
"integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==",
"dev": true,
"requires": {
"type-fest": "^0.8.1"
@ -2739,9 +2739,9 @@
"dev": true
},
"inquirer": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.6.tgz",
"integrity": "sha512-7SVO4h+QIdMq6XcqIqrNte3gS5MzCCKZdsq9DO4PJziBFNYzP3PGFbDjgadDb//MCahzgjCxvQ/O2wa7kx9o4w==",
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.1.0.tgz",
"integrity": "sha512-5fJMWEmikSYu0nv/flMc475MhGbB7TSPd/2IpFV4I4rMklboCH2rQjYY5kKiYGHqUF9gvaambupcJFFG9dvReg==",
"dev": true,
"requires": {
"ansi-escapes": "^4.2.1",
@ -3682,9 +3682,9 @@
},
"dependencies": {
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"dev": true
}
}
@ -4430,9 +4430,9 @@
}
},
"regenerator-runtime": {
"version": "0.13.4",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.4.tgz",
"integrity": "sha512-plpwicqEzfEyTQohIKktWigcLzmNStMGwbOUbykx51/29Z3JOGYldaaNGK7ngNXV+UcoqvIMmloZ48Sr74sd+g==",
"version": "0.13.5",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz",
"integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==",
"dev": true
},
"regex-not": {
@ -4782,9 +4782,9 @@
}
},
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"dev": true
},
"normalize-path": {
@ -5506,6 +5506,16 @@
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"dev": true
},
"yargs-parser": {
"version": "16.1.0",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-16.1.0.tgz",
"integrity": "sha512-H/V41UNZQPkUMIT5h5hiwg4QKIY1RPvoBV4XcjUbRM8Bk2oKqqyZ0DIEbTFZB0XjbtSPG8SAa/0DxCQmiRgzKg==",
"dev": true,
"requires": {
"camelcase": "^5.0.0",
"decamelize": "^1.2.0"
}
}
}
},
@ -5850,9 +5860,9 @@
}
},
"ws": {
"version": "7.2.1",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.2.1.tgz",
"integrity": "sha512-sucePNSafamSKoOqoNfBd8V0StlkzJKL2ZAhGQinCfNQ+oacw+Pk7lcdAElecBF2VkLNZRiIb5Oi1Q5lVUVt2A==",
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz",
"integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ==",
"dev": true
},
"xml-name-validator": {
@ -5874,18 +5884,18 @@
"dev": true
},
"yaml": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-1.8.0.tgz",
"integrity": "sha512-6qI/tTx7OVtA4qNqD0OyutbM6Z9EKu4rxWm/2Y3FDEBQ4/2X2XAnyuRXMzAE2+1BPyqzksJZtrIwblOHg0IEzA==",
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-1.8.2.tgz",
"integrity": "sha512-omakb0d7FjMo3R1D2EbTKVIk6dAVLRxFXdLZMEUToeAvuqgG/YuHMuQOZ5fgk+vQ8cx+cnGKwyg+8g8PNT0xQg==",
"dev": true,
"requires": {
"@babel/runtime": "^7.8.7"
}
},
"yargs": {
"version": "15.1.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-15.1.0.tgz",
"integrity": "sha512-T39FNN1b6hCW4SOIk1XyTOWxtXdcen0t+XYrysQmChzSipvhBO8Bj0nK1ozAasdk24dNWuMZvr4k24nz+8HHLg==",
"version": "15.3.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-15.3.0.tgz",
"integrity": "sha512-g/QCnmjgOl1YJjGsnUg2SatC7NUYEiLXJqxNOQU9qSpjzGtGXda9b+OKccr1kLTy8BN9yqEyqfq5lxlwdc13TA==",
"dev": true,
"requires": {
"cliui": "^6.0.0",
@ -5898,7 +5908,7 @@
"string-width": "^4.2.0",
"which-module": "^2.0.0",
"y18n": "^4.0.0",
"yargs-parser": "^16.1.0"
"yargs-parser": "^18.1.0"
},
"dependencies": {
"find-up": {
@ -5953,9 +5963,9 @@
}
},
"yargs-parser": {
"version": "16.1.0",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-16.1.0.tgz",
"integrity": "sha512-H/V41UNZQPkUMIT5h5hiwg4QKIY1RPvoBV4XcjUbRM8Bk2oKqqyZ0DIEbTFZB0XjbtSPG8SAa/0DxCQmiRgzKg==",
"version": "18.1.0",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.0.tgz",
"integrity": "sha512-o/Jr6JBOv6Yx3pL+5naWSoIA2jJ+ZkMYQG/ie9qFbukBe4uzmBatlXFOiu/tNKRWEtyf+n5w7jc/O16ufqOTdQ==",
"dev": true,
"requires": {
"camelcase": "^5.0.0",

View File

@ -1,6 +1,6 @@
{
"name": "setup-php",
"version": "2.1.1",
"version": "2.1.2",
"private": false,
"description": "Setup PHP for use with GitHub Actions",
"main": "dist/index.js",
@ -31,9 +31,9 @@
},
"devDependencies": {
"@types/jest": "^25.1.4",
"@types/node": "^13.9.0",
"@typescript-eslint/eslint-plugin": "^2.22.0",
"@typescript-eslint/parser": "^2.22.0",
"@types/node": "^13.9.1",
"@typescript-eslint/eslint-plugin": "^2.23.0",
"@typescript-eslint/parser": "^2.23.0",
"@zeit/ncc": "^0.21.1",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",

View File

@ -44,6 +44,7 @@ export async function addINIValuesWindows(
*
* @param ini_values_csv
* @param os_version
* @param no_step
*/
export async function addINIValues(
ini_values_csv: string,

View File

@ -16,18 +16,18 @@ export async function addExtensionDarwin(
const extensions: Array<string> = await utils.extensionArray(extension_csv);
let script = '\n';
await utils.asyncForEach(extensions, async function(extension: string) {
extension = extension.toLowerCase();
const version_extension: string = version + extension;
const [ext_name, ext_version]: string[] = extension.split('-');
const prefix = await utils.getExtensionPrefix(ext_name);
let install_command = '';
const ext_prefix = await utils.getExtensionPrefix(ext_name);
const command_prefix = 'sudo pecl install -f ';
let command = '';
switch (true) {
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
// match 5.3blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
version_extension
):
install_command =
command =
'bash ' +
path.join(__dirname, '../src/scripts/ext/blackfire_darwin.sh') +
' ' +
@ -35,7 +35,7 @@ export async function addExtensionDarwin(
' ' +
(await utils.getBlackfireVersion(ext_version));
break;
// match pre-release versions
// match pre-release versions. For example - xdebug-beta
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
script +=
'\nadd_unstable_extension ' +
@ -43,35 +43,54 @@ export async function addExtensionDarwin(
' ' +
ext_version +
' ' +
prefix;
ext_prefix;
return;
// match exact versions
// match semver
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
script +=
'\nadd_pecl_extension ' + ext_name + ' ' + ext_version + ' ' + prefix;
'\nadd_pecl_extension ' +
ext_name +
' ' +
ext_version +
' ' +
ext_prefix;
return;
// match 5.3xdebug
case /5\.3xdebug/.test(version_extension):
install_command = 'sudo pecl install -f xdebug-2.2.7' + pipe;
command = command_prefix + 'xdebug-2.2.7' + pipe;
break;
// match 5.4xdebug
case /5\.4xdebug/.test(version_extension):
install_command = 'sudo pecl install -f xdebug-2.4.1' + pipe;
command = command_prefix + 'xdebug-2.4.1' + pipe;
break;
// match 5.5xdebug and 5.6xdebug
case /5\.[5-6]xdebug/.test(version_extension):
install_command = 'sudo pecl install -f xdebug-2.5.5' + pipe;
command = command_prefix + 'xdebug-2.5.5' + pipe;
break;
// match 7.0redis
case /7\.0xdebug/.test(version_extension):
install_command = 'sudo pecl install -f xdebug-2.9.0' + pipe;
command = command_prefix + 'xdebug-2.9.0' + pipe;
break;
// match 5.6redis
case /5\.6redis/.test(version_extension):
install_command = 'sudo pecl install -f redis-2.2.8' + pipe;
command = command_prefix + 'redis-2.2.8' + pipe;
break;
case /[5-9]\.\dimagick/.test(version_extension):
install_command =
// match imagick
case /imagick/.test(extension):
command =
'brew install pkg-config imagemagick' +
pipe +
' && sudo pecl install -f imagick' +
' && ' +
command_prefix +
'imagick' +
pipe;
break;
// match sqlite
case /sqlite/.test(extension):
extension = 'sqlite3';
command = command_prefix + extension + pipe;
break;
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
script +=
'sh ' +
@ -82,16 +101,11 @@ export async function addExtensionDarwin(
version;
return;
default:
install_command = 'sudo pecl install -f ' + extension + pipe;
command = command_prefix + extension + pipe;
break;
}
script +=
'\nadd_extension ' +
extension +
' "' +
install_command +
'" ' +
(await utils.getExtensionPrefix(extension));
'\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix;
});
return script;
}
@ -101,17 +115,14 @@ export async function addExtensionDarwin(
*
* @param extension_csv
* @param version
* @param pipe
*/
export async function addExtensionWindows(
extension_csv: string,
version: string,
pipe: string
version: string
): Promise<string> {
const extensions: Array<string> = await utils.extensionArray(extension_csv);
let script = '\n';
await utils.asyncForEach(extensions, async function(extension: string) {
extension = extension.toLowerCase();
const [ext_name, ext_version]: string[] = extension.split('-');
const version_extension: string = version + extension;
let matches: RegExpExecArray;
@ -129,23 +140,29 @@ export async function addExtensionWindows(
' ' +
(await utils.getBlackfireVersion(ext_version));
return;
// match pre-release versions
// match pre-release versions. For example - xdebug-beta
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
script += '\nAdd-Extension ' + ext_name + ' ' + ext_version;
break;
// match exact versions
// match semver without state
case /.*-\d+\.\d+\.\d+$/.test(version_extension):
script += '\nAdd-Extension ' + ext_name + ' stable ' + ext_version;
return;
case /.*-(\d+\.\d+\.\d)+(beta|alpha|devel|snapshot)\d*/.test(
// match semver with state
case /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.test(
version_extension
):
matches = /.*-(\d+\.\d+\.\d)+(beta|alpha|devel|snapshot)\d*/.exec(
matches = /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.exec(
version_extension
) as RegExpExecArray;
script +=
'\nAdd-Extension ' + ext_name + ' ' + matches[2] + ' ' + matches[1];
return;
// match sqlite
case /sqlite/.test(extension):
extension = 'sqlite3';
script += '\nAdd-Extension ' + extension;
break;
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
script +=
@ -180,18 +197,18 @@ export async function addExtensionLinux(
const extensions: Array<string> = await utils.extensionArray(extension_csv);
let script = '\n';
await utils.asyncForEach(extensions, async function(extension: string) {
extension = extension.toLowerCase();
const version_extension: string = version + extension;
const [ext_name, ext_version]: string[] = extension.split('-');
const prefix = await utils.getExtensionPrefix(ext_name);
let install_command = '';
const ext_prefix = await utils.getExtensionPrefix(ext_name);
const command_prefix = 'sudo $debconf_fix apt-get install -y php';
let command = '';
switch (true) {
// match 5.3blackfire...5.6blackfire, 7.0blackfire...7.4blackfire
// match 5.3blackfire-1.31.0...5.6blackfire-1.31.0, 7.0blackfire-1.31.0...7.4blackfire-1.31.0
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
version_extension
):
install_command =
command =
'bash ' +
path.join(__dirname, '../src/scripts/ext/blackfire.sh') +
' ' +
@ -199,7 +216,7 @@ export async function addExtensionLinux(
' ' +
(await utils.getBlackfireVersion(ext_version));
break;
// match pre-release versions
// match pre-release versions. For example - xdebug-beta
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
script +=
'\nadd_unstable_extension ' +
@ -207,16 +224,21 @@ export async function addExtensionLinux(
' ' +
ext_version +
' ' +
prefix;
ext_prefix;
return;
// match exact versions
// match semver versions
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
script +=
'\nadd_pecl_extension ' + ext_name + ' ' + ext_version + ' ' + prefix;
'\nadd_pecl_extension ' +
ext_name +
' ' +
ext_version +
' ' +
ext_prefix;
return;
// match 5.6gearman..7.4gearman
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
install_command =
command =
'sh ' +
path.join(__dirname, '../src/scripts/ext/gearman.sh') +
' ' +
@ -236,28 +258,27 @@ export async function addExtensionLinux(
// match 7.0xdebug..7.4xdebug
case /^7\.[0-4]xdebug$/.test(version_extension):
script +=
'\nupdate_extension xdebug 2.9.1' +
'\nupdate_extension xdebug 2.9.2' +
pipe +
'\n' +
(await utils.addLog('$tick', 'xdebug', 'Enabled', 'linux'));
return;
// match pdo extensions
case /.*pdo[_-].*/.test(version_extension):
script +=
'\nadd_pdo_extension ' +
extension.replace('pdo_', '').replace('pdo-', '');
extension = extension.replace('pdo_', '').replace('pdo-', '');
script += '\nadd_pdo_extension ' + extension;
return;
// match sqlite
case /sqlite/.test(extension):
extension = 'sqlite3';
command = command_prefix + version + '-' + extension + pipe;
break;
default:
install_command =
'sudo $debconf_fix apt-get install -y php' +
version +
'-' +
extension +
pipe;
command = command_prefix + version + '-' + extension + pipe;
break;
}
script +=
'\nadd_extension ' + extension + ' "' + install_command + '" ' + prefix;
'\nadd_extension ' + extension + ' "' + command + '" ' + ext_prefix;
});
return script;
}
@ -268,7 +289,7 @@ export async function addExtensionLinux(
* @param extension_csv
* @param version
* @param os_version
* @param log_prefix
* @param no_step
*/
export async function addExtension(
extension_csv: string,
@ -290,7 +311,7 @@ export async function addExtension(
switch (os_version) {
case 'win32':
return script + (await addExtensionWindows(extension_csv, version, pipe));
return script + (await addExtensionWindows(extension_csv, version));
case 'darwin':
return script + (await addExtensionDarwin(extension_csv, version, pipe));
case 'linux':

View File

@ -35,7 +35,7 @@ export async function build(
tools_csv = 'pecl, ' + tools_csv;
}
let script: string = await utils.readScript(filename, version, os_version);
let script: string = await utils.readScript(filename);
script += await tools.addTools(tools_csv, version, os_version);
if (extension_csv) {

View File

@ -4,6 +4,7 @@ import * as utils from './utils';
* Function to get command to setup tools
*
* @param os_version
* @param suffix
*/
export async function getCommand(
os_version: string,
@ -69,6 +70,8 @@ export async function parseTool(
/**
* Function to get the url of tool with the given version
*
* @param tool
* @param extension
* @param version
* @param prefix
* @param version_prefix
@ -167,16 +170,14 @@ export async function getCodeceptionUri(
case /(^2\.(1\.[0-5]|0\.\d+)|^1\.[6-8]\.\d+).*/.test(version):
return codecept;
default:
return await codecept;
return codecept;
}
}
/**
* Helper function to get script to setup phive
*
* @param tool
* @param version
* @param url
* @param os_version
*/
export async function addPhive(
@ -204,6 +205,9 @@ export async function addPhive(
/**
* Function to get the phar url in domain/tool-version.phar format
*
* @param domain
* @param tool
* @param prefix
* @param version
*/
export async function getPharUrl(
@ -293,7 +297,7 @@ export async function getWpCliUrl(version: string): Promise<string> {
/**
* Function to add/move composer in the tools list
*
* @param tools
* @param tools_list
*/
export async function addComposer(tools_list: string[]): Promise<string[]> {
const regex = /^composer($|:.*)/;
@ -402,7 +406,8 @@ export async function addPackage(
/**
* Setup tools
*
* @param tool_csv
* @param tools_csv
* @param php_version
* @param os_version
*/
export async function addTools(

View File

@ -65,7 +65,6 @@ export async function color(type: string): Promise<string> {
* @param message
* @param os_version
* @param log_type
* @param prefix
*/
export async function log(
message: string,
@ -121,6 +120,7 @@ export async function stepLog(
* @param mark
* @param subject
* @param message
* @param os_version
*/
export async function addLog(
mark: string,
@ -147,14 +147,8 @@ export async function addLog(
* Read the scripts
*
* @param filename
* @param version
* @param os_version
*/
export async function readScript(
filename: string,
version: string,
os_version: string
): Promise<string> {
export async function readScript(filename: string): Promise<string> {
return fs.readFileSync(
path.join(__dirname, '../src/scripts/' + filename),
'utf8'
@ -165,7 +159,6 @@ export async function readScript(
* Write final script which runs
*
* @param filename
* @param version
* @param script
*/
export async function writeScript(
@ -196,6 +189,7 @@ export async function extensionArray(
.map(function(extension: string) {
return extension
.trim()
.toLowerCase()
.replace('php-', '')
.replace('php_', '');
})

View File

@ -2,7 +2,7 @@
"compilerOptions": {
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"target": "ES2020", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */