deployer/recipe/deploy/vendors.php

30 lines
1010 B
PHP
Raw Normal View History

2016-11-19 15:13:32 +07:00
<?php
2020-10-08 01:19:39 +02:00
2016-11-19 15:13:32 +07:00
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 --no-suggest');
set('bin/composer', function () {
if (commandExist('composer')) {
return '{{bin/php}} ' . locateBinaryPath('composer');
}
if (test('[ -f {{deploy_path}}/.dep/composer.phar ]')) {
return '{{bin/php}} {{deploy_path}}/.dep/composer.phar';
}
run("cd {{release_path}} && curl -sS https://getcomposer.org/installer | {{bin/php}}");
run('mv {{release_path}}/composer.phar {{deploy_path}}/.dep/composer.phar');
return '{{bin/php}} {{deploy_path}}/.dep/composer.phar';
});
2016-11-19 15:13:32 +07:00
desc('Installing vendors');
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
}
2020-10-08 01:19:39 +02:00
run('cd {{release_path}} && {{bin/composer}} {{composer_action}} {{composer_options}} 2>&1');
2016-11-19 15:13:32 +07:00
});