deployer/recipe/deploy/vendors.php

33 lines
1.3 KiB
PHP
Raw Normal View History

2016-11-19 15:13:32 +07:00
<?php
namespace Deployer;
2020-10-08 01:19:39 +02:00
set('composer_action', 'install');
set('composer_options', '--verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader');
2020-10-08 01:19:39 +02:00
2020-12-18 20:13:28 +01:00
// 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`.
2020-10-08 01:19:39 +02:00
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}} ' . locateBinaryPath('composer');
}
warning("Composer binary wasn't found. Installing latest composer to \"{{deploy_path}}/.dep/composer.phar\".");
2020-12-18 20:13:28 +01:00
run("cd {{deploy_path}} && curl -sS https://getcomposer.org/installer | {{bin/php}}");
run('mv {{deploy_path}}/composer.phar {{deploy_path}}/.dep/composer.phar');
2020-10-08 01:19:39 +02:00
return '{{bin/php}} {{deploy_path}}/.dep/composer.phar';
});
2021-10-11 22:10:24 +02:00
desc('Install vendors');
2016-11-19 15:13:32 +07:00
task('deploy:vendors', function () {
2017-06-05 12:53:01 +07:00
if (!commandExist('unzip')) {
2020-04-25 23:00:08 +03:00
warning('To speed up composer installation setup "unzip" command with PHP zip extension.');
2017-06-05 12:53:01 +07:00
}
run('cd {{release_or_current_path}} && {{bin/composer}} {{composer_action}} {{composer_options}} 2>&1');
2016-11-19 15:13:32 +07:00
});