mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 05:23:03 +07:00
Update symfony-cli support to use new symfony-cli/symfony-cli
This commit is contained in:
parent
8d1c02194f
commit
71d07ee7f4
@ -318,25 +318,6 @@ describe('Tools tests', () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
it.each`
|
|
||||||
version | os | uri
|
|
||||||
${'latest'} | ${'linux'} | ${'releases/latest/download/symfony_linux_amd64'}
|
|
||||||
${'1.2.3'} | ${'linux'} | ${'releases/download/v1.2.3/symfony_linux_amd64'}
|
|
||||||
${'latest'} | ${'darwin'} | ${'releases/latest/download/symfony_darwin_amd64'}
|
|
||||||
${'1.2.3'} | ${'darwin'} | ${'releases/download/v1.2.3/symfony_darwin_amd64'}
|
|
||||||
${'latest'} | ${'win32'} | ${'releases/latest/download/symfony_windows_amd64.exe'}
|
|
||||||
${'1.2.3'} | ${'win32'} | ${'releases/download/v1.2.3/symfony_windows_amd64.exe'}
|
|
||||||
${'latest'} | ${'openbsd'} | ${'Platform openbsd is not supported'}
|
|
||||||
`('checking addSymfony: $version, $os', async ({version, os, uri}) => {
|
|
||||||
const data = getData({
|
|
||||||
tool: 'symfony',
|
|
||||||
php_version: '7.4',
|
|
||||||
version: version,
|
|
||||||
os: os
|
|
||||||
});
|
|
||||||
expect(await tools.addSymfony(data)).toContain(uri);
|
|
||||||
});
|
|
||||||
|
|
||||||
it.each`
|
it.each`
|
||||||
version | uri
|
version | uri
|
||||||
${'latest'} | ${'wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true'}
|
${'latest'} | ${'wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true'}
|
||||||
@ -397,7 +378,7 @@ describe('Tools tests', () => {
|
|||||||
'add_devtools php-config',
|
'add_devtools php-config',
|
||||||
'add_devtools phpize',
|
'add_devtools phpize',
|
||||||
'add_protoc latest',
|
'add_protoc latest',
|
||||||
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_linux_amd64 symfony-cli "version"',
|
'add_symfony latest',
|
||||||
'add_composertool vapor-cli vapor-cli laravel/ scoped',
|
'add_composertool vapor-cli vapor-cli laravel/ scoped',
|
||||||
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
|
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
|
||||||
]
|
]
|
||||||
@ -411,7 +392,7 @@ describe('Tools tests', () => {
|
|||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
[
|
[
|
||||||
'behat, blackfire, blackfire-player, churn, composer-normalize, composer-require-checker, composer-unused, cs2pr:1.2.3, flex, grpc_php_plugin:1.2.3, infection, phan, phan:1.2.3, phing:1.2.3, phinx, phive:1.2.3, php-config, phpcbf, phpcpd, phpcs, phpdoc, phpize, phpmd, phpspec, phpunit-bridge:5.6, phpunit-polyfills:1.0.1, protoc:v1.2.3, psalm, symfony-cli, symfony:1.2.3, vapor-cli, wp-cli',
|
'behat, blackfire, blackfire-player, churn, composer-normalize, composer-require-checker, composer-unused, cs2pr:1.2.3, flex, grpc_php_plugin:1.2.3, infection, phan, phan:1.2.3, phing:1.2.3, phinx, phive:1.2.3, php-config, phpcbf, phpcpd, phpcs, phpdoc, phpize, phpmd, phpspec, phpunit-bridge:5.6, phpunit-polyfills:1.0.1, protoc:v1.2.3, psalm, symfony-cli, vapor-cli, wp-cli',
|
||||||
[
|
[
|
||||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer',
|
||||||
'add_composertool behat behat behat/ scoped',
|
'add_composertool behat behat behat/ scoped',
|
||||||
@ -442,8 +423,7 @@ describe('Tools tests', () => {
|
|||||||
'add_composertool phpunit-polyfills phpunit-polyfills:1.0.1 yoast/ global',
|
'add_composertool phpunit-polyfills phpunit-polyfills:1.0.1 yoast/ global',
|
||||||
'add_protoc 1.2.3',
|
'add_protoc 1.2.3',
|
||||||
'add_tool https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm "-v"',
|
'add_tool https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm "-v"',
|
||||||
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_darwin_amd64 symfony-cli "version"',
|
'add_symfony latest',
|
||||||
'add_tool https://github.com/symfony/cli/releases/download/v1.2.3/symfony_darwin_amd64 symfony-cli "version"',
|
|
||||||
'add_composertool vapor-cli vapor-cli laravel/ scoped',
|
'add_composertool vapor-cli vapor-cli laravel/ scoped',
|
||||||
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
|
'add_tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
|
||||||
]
|
]
|
||||||
@ -473,7 +453,7 @@ describe('Tools tests', () => {
|
|||||||
'phpize is not a windows tool',
|
'phpize is not a windows tool',
|
||||||
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"',
|
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd "--version"',
|
||||||
'Add-Composertool phpunit-bridge phpunit-bridge symfony/ global',
|
'Add-Composertool phpunit-bridge phpunit-bridge symfony/ global',
|
||||||
'Add-Tool https://github.com/symfony/cli/releases/latest/download/symfony_windows_amd64.exe symfony-cli "version"',
|
'Add-Symfony',
|
||||||
'Add-Tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
|
'Add-Tool https://github.com/wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true wp-cli "--version"'
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
26
dist/index.js
vendored
26
dist/index.js
vendored
@ -529,7 +529,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.addTools = exports.functionRecord = exports.getData = exports.addWPCLI = exports.addSymfony = exports.addPHPUnitTools = exports.addPhive = exports.addPhing = exports.addPECL = exports.addDevTools = exports.addDeployer = exports.addComposer = exports.addBlackfirePlayer = exports.addPackage = exports.addArchive = exports.getPharUrl = exports.getUrl = exports.filterList = exports.getRelease = exports.getVersion = exports.getLatestVersion = exports.getSemverVersion = void 0;
|
exports.addTools = exports.functionRecord = exports.getData = exports.addWPCLI = exports.addPHPUnitTools = exports.addPhive = exports.addPhing = exports.addPECL = exports.addDevTools = exports.addDeployer = exports.addComposer = exports.addBlackfirePlayer = exports.addPackage = exports.addArchive = exports.getPharUrl = exports.getUrl = exports.filterList = exports.getRelease = exports.getVersion = exports.getLatestVersion = exports.getSemverVersion = void 0;
|
||||||
const utils = __importStar(__nccwpck_require__(918));
|
const utils = __importStar(__nccwpck_require__(918));
|
||||||
const path_1 = __importDefault(__nccwpck_require__(17));
|
const path_1 = __importDefault(__nccwpck_require__(17));
|
||||||
const fs_1 = __importDefault(__nccwpck_require__(147));
|
const fs_1 = __importDefault(__nccwpck_require__(147));
|
||||||
@ -759,29 +759,6 @@ async function addPHPUnitTools(data) {
|
|||||||
return await addArchive(data);
|
return await addArchive(data);
|
||||||
}
|
}
|
||||||
exports.addPHPUnitTools = addPHPUnitTools;
|
exports.addPHPUnitTools = addPHPUnitTools;
|
||||||
async function addSymfony(data) {
|
|
||||||
let filename;
|
|
||||||
switch (data['os']) {
|
|
||||||
case 'linux':
|
|
||||||
case 'darwin':
|
|
||||||
filename = 'symfony_' + data['os'] + '_amd64';
|
|
||||||
break;
|
|
||||||
case 'win32':
|
|
||||||
filename = 'symfony_windows_amd64.exe';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return await utils.log('Platform ' + data['os'] + ' is not supported', data['os'], 'error');
|
|
||||||
}
|
|
||||||
if (data['version'] === 'latest') {
|
|
||||||
data['uri'] = ['releases/latest/download', filename].join('/');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
data['uri'] = ['releases/download', 'v' + data['version'], filename].join('/');
|
|
||||||
}
|
|
||||||
data['url'] = [data['domain'], data['repository'], data['uri']].join('/');
|
|
||||||
return await addArchive(data);
|
|
||||||
}
|
|
||||||
exports.addSymfony = addSymfony;
|
|
||||||
async function addWPCLI(data) {
|
async function addWPCLI(data) {
|
||||||
if (data['version'] === 'latest') {
|
if (data['version'] === 'latest') {
|
||||||
data['uri'] = 'wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true';
|
data['uri'] = 'wp-cli/builds/blob/gh-pages/phar/wp-cli.phar?raw=true';
|
||||||
@ -853,7 +830,6 @@ exports.functionRecord = {
|
|||||||
phing: addPhing,
|
phing: addPhing,
|
||||||
phpunit: addPHPUnitTools,
|
phpunit: addPHPUnitTools,
|
||||||
phpcpd: addPHPUnitTools,
|
phpcpd: addPHPUnitTools,
|
||||||
symfony: addSymfony,
|
|
||||||
wp_cli: addWPCLI
|
wp_cli: addWPCLI
|
||||||
};
|
};
|
||||||
async function addTools(tools_csv, php_version, os) {
|
async function addTools(tools_csv, php_version, os) {
|
||||||
|
@ -192,6 +192,13 @@
|
|||||||
"domain": "https://github.com",
|
"domain": "https://github.com",
|
||||||
"version_prefix": "v"
|
"version_prefix": "v"
|
||||||
},
|
},
|
||||||
|
"symfony-cli": {
|
||||||
|
"alias": "symfony",
|
||||||
|
"type": "custom-package",
|
||||||
|
"repository": "symfony-cli/symfony-cli",
|
||||||
|
"domain": "https://github.com",
|
||||||
|
"version_prefix": "-V"
|
||||||
|
},
|
||||||
"blackfire-player": {
|
"blackfire-player": {
|
||||||
"type": "custom-function",
|
"type": "custom-function",
|
||||||
"domain": "https://get.blackfire.io",
|
"domain": "https://get.blackfire.io",
|
||||||
@ -259,15 +266,6 @@
|
|||||||
"type": "custom-function",
|
"type": "custom-function",
|
||||||
"function": "dev_tools"
|
"function": "dev_tools"
|
||||||
},
|
},
|
||||||
"symfony-cli": {
|
|
||||||
"type": "custom-function",
|
|
||||||
"function": "symfony",
|
|
||||||
"alias": "symfony",
|
|
||||||
"domain": "https://github.com",
|
|
||||||
"repository": "symfony/cli",
|
|
||||||
"version_prefix": "v",
|
|
||||||
"version_parameter": "version"
|
|
||||||
},
|
|
||||||
"wp-cli": {
|
"wp-cli": {
|
||||||
"type": "custom-function",
|
"type": "custom-function",
|
||||||
"function": "wp_cli",
|
"function": "wp_cli",
|
||||||
|
@ -73,9 +73,6 @@ Function Add-ToolsHelper() {
|
|||||||
} elseif($tool -eq "phpDocumentor") {
|
} elseif($tool -eq "phpDocumentor") {
|
||||||
Add-Extension fileinfo >$null 2>&1
|
Add-Extension fileinfo >$null 2>&1
|
||||||
Copy-Item $bin_dir\phpDocumentor.bat -Destination $bin_dir\phpdoc.bat
|
Copy-Item $bin_dir\phpDocumentor.bat -Destination $bin_dir\phpdoc.bat
|
||||||
} elseif($tool -eq "symfony-cli") {
|
|
||||||
Add-ToProfile $current_profile "symfony" "New-Alias symfony $bin_dir\symfony-cli.exe"
|
|
||||||
Add-ToProfile $current_profile "symfony_cli" "New-Alias symfony-cli $bin_dir\symfony-cli.exe"
|
|
||||||
} elseif($tool -match "vapor-cli") {
|
} elseif($tool -match "vapor-cli") {
|
||||||
Copy-Item $env:vapor_cli_bin\vapor.bat -Destination $env:vapor_cli_bin\vapor-cli.bat
|
Copy-Item $env:vapor_cli_bin\vapor.bat -Destination $env:vapor_cli_bin\vapor-cli.bat
|
||||||
} elseif($tool -eq "wp-cli") {
|
} elseif($tool -eq "wp-cli") {
|
||||||
|
@ -76,7 +76,7 @@ add_tools_helper() {
|
|||||||
fi
|
fi
|
||||||
elif [[ "$tool" =~ vapor-cli ]]; then
|
elif [[ "$tool" =~ vapor-cli ]]; then
|
||||||
sudo ln -s "$scoped_dir"/vendor/bin/vapor "$scoped_dir"/vendor/bin/vapor-cli
|
sudo ln -s "$scoped_dir"/vendor/bin/vapor "$scoped_dir"/vendor/bin/vapor-cli
|
||||||
elif [[ "$tool" =~ (symfony|vapor|wp)-cli ]]; then
|
elif [ "$tool" = wp-cli ]; then
|
||||||
sudo ln -s "$tool_path" "$tool_path_dir"/"${tool%-*}"
|
sudo ln -s "$tool_path" "$tool_path_dir"/"${tool%-*}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
14
src/scripts/tools/symfony.ps1
Normal file
14
src/scripts/tools/symfony.ps1
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
Function Add-Symfony() {
|
||||||
|
$arch_name ='amd64'
|
||||||
|
if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
|
||||||
|
$arch_name = '386'
|
||||||
|
}
|
||||||
|
$url = "https://github.com/symfony-cli/symfony-cli/releases/latest/download/symfony-cli_windows_${arch_name}.zip"
|
||||||
|
Invoke-WebRequest -Uri $url -OutFile $bin_dir\symfony.zip >$null 2>&1
|
||||||
|
Expand-Archive -Path $bin_dir\symfony.zip -DestinationPath $bin_dir -Force >$null 2>&1
|
||||||
|
Copy-Item -Path $bin_dir\symfony.exe -Destination $bin_dir\symfony-cli.exe >$null 2>&1
|
||||||
|
Add-ToProfile $current_profile 'symfony' "New-Alias symfony $bin_dir\symfony.exe"
|
||||||
|
Add-ToProfile $current_profile 'symfony_cli' "New-Alias symfony-cli $bin_dir\symfony-cli.exe"
|
||||||
|
$tool_version = Get-ToolVersion symfony "-V"
|
||||||
|
Add-Log $tick "symfony-cli" "Added symfony-cli $tool_version"
|
||||||
|
}
|
13
src/scripts/tools/symfony.sh
Normal file
13
src/scripts/tools/symfony.sh
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
add_symfony() {
|
||||||
|
if [ "$(uname -s)" = "Linux" ]; then
|
||||||
|
echo 'deb [trusted=yes] https://repo.symfony.com/apt/ /' | sudo tee /etc/apt/sources.list.d/symfony-cli.list >/dev/null 2>&1
|
||||||
|
update_lists symfony repo.symfony.com
|
||||||
|
install_packages symfony-cli
|
||||||
|
elif [ "$(uname -s)" = "Darwin" ]; then
|
||||||
|
add_brew_tap symfony-cli/homebrew-tap
|
||||||
|
brew install symfony-cli/tap/symfony-cli >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
sudo ln -s "$(command -v symfony)" "${tool_path_dir:?}"/symfony-cli
|
||||||
|
tool_version=$(get_tool_version "symfony" "-V")
|
||||||
|
add_log "${tick:?}" "symfony-cli" "Added symfony-cli $tool_version"
|
||||||
|
}
|
34
src/tools.ts
34
src/tools.ts
@ -357,39 +357,6 @@ export async function addPHPUnitTools(data: RS): Promise<string> {
|
|||||||
return await addArchive(data);
|
return await addArchive(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Function to add Symfony
|
|
||||||
*
|
|
||||||
* @param data
|
|
||||||
*/
|
|
||||||
export async function addSymfony(data: RS): Promise<string> {
|
|
||||||
let filename: string;
|
|
||||||
switch (data['os']) {
|
|
||||||
case 'linux':
|
|
||||||
case 'darwin':
|
|
||||||
filename = 'symfony_' + data['os'] + '_amd64';
|
|
||||||
break;
|
|
||||||
case 'win32':
|
|
||||||
filename = 'symfony_windows_amd64.exe';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return await utils.log(
|
|
||||||
'Platform ' + data['os'] + ' is not supported',
|
|
||||||
data['os'],
|
|
||||||
'error'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (data['version'] === 'latest') {
|
|
||||||
data['uri'] = ['releases/latest/download', filename].join('/');
|
|
||||||
} else {
|
|
||||||
data['uri'] = ['releases/download', 'v' + data['version'], filename].join(
|
|
||||||
'/'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
data['url'] = [data['domain'], data['repository'], data['uri']].join('/');
|
|
||||||
return await addArchive(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to add WP-CLI
|
* Function to add WP-CLI
|
||||||
*
|
*
|
||||||
@ -475,7 +442,6 @@ export const functionRecord: Record<string, (data: RS) => Promise<string>> = {
|
|||||||
phing: addPhing,
|
phing: addPhing,
|
||||||
phpunit: addPHPUnitTools,
|
phpunit: addPHPUnitTools,
|
||||||
phpcpd: addPHPUnitTools,
|
phpcpd: addPHPUnitTools,
|
||||||
symfony: addSymfony,
|
|
||||||
wp_cli: addWPCLI
|
wp_cli: addWPCLI
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user