mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-23 16:54:08 +01:00
33 lines
1.3 KiB
PHP
33 lines
1.3 KiB
PHP
<?php
|
|
namespace Deployer;
|
|
|
|
set('composer_action', 'install');
|
|
|
|
set('composer_options', '--verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader');
|
|
|
|
// Returns Composer binary path in found. Otherwise try to install latest
|
|
// composer version to `.dep/composer.phar`. To use specific composer version
|
|
// download desired phar and place it at `.dep/composer.phar`.
|
|
set('bin/composer', function () {
|
|
if (test('[ -f {{deploy_path}}/.dep/composer.phar ]')) {
|
|
return '{{bin/php}} {{deploy_path}}/.dep/composer.phar';
|
|
}
|
|
|
|
if (commandExist('composer')) {
|
|
return '{{bin/php}} ' . which('composer');
|
|
}
|
|
|
|
warning("Composer binary wasn't found. Installing latest composer to \"{{deploy_path}}/.dep/composer.phar\".");
|
|
run("cd {{deploy_path}} && curl -sS https://getcomposer.org/installer | {{bin/php}}");
|
|
run('mv {{deploy_path}}/composer.phar {{deploy_path}}/.dep/composer.phar');
|
|
return '{{bin/php}} {{deploy_path}}/.dep/composer.phar';
|
|
});
|
|
|
|
desc('Install vendors');
|
|
task('deploy:vendors', function () {
|
|
if (!commandExist('unzip')) {
|
|
warning('To speed up composer installation setup "unzip" command with PHP zip extension.');
|
|
}
|
|
run('cd {{release_or_current_path}} && {{bin/composer}} {{composer_action}} {{composer_options}} 2>&1');
|
|
});
|