'something', * ]); * ``` * * It is possible to override it per `run()` call. * * ```php * run('echo $KEY', ['env' => ['KEY' => 'over']] * ``` */ set('env', []); /** * Path to `.env` file which will be used as environment variables for each command per `run()`. * * ```php * set('dotenv', '{{current_path}}/.env'); * ``` */ set('dotenv', false); /** * Return current release path. Default to {{deploy_path}}/`current`. * ```php * set('current_path', '/var/public_html'); * ``` */ set('current_path', '{{deploy_path}}/current'); // Custom php bin of remote host. set('bin/php', function () { return locateBinaryPath('php'); }); // Custom git bin of remote host. set('bin/git', function () { return locateBinaryPath('git'); }); // Custom ln bin of remote host. set('bin/symlink', function () { return get('use_relative_symlink') ? 'ln -nfs --relative' : 'ln -nfs'; }); // Path to a file which will store temp script with sudo password. // Defaults to `.dep/sudo_pass`. This script is only temporary and will be deleted after // sudo command executed. set('sudo_askpass', function () { if (test('[ -d {{deploy_path}}/.dep ]')) { return '{{deploy_path}}/.dep/sudo_pass'; } else { return '/tmp/dep_sudo_pass'; } }); option('tag', null, InputOption::VALUE_REQUIRED, 'Tag to deploy'); option('revision', null, InputOption::VALUE_REQUIRED, 'Revision to deploy'); option('branch', null, InputOption::VALUE_REQUIRED, 'Branch to deploy'); // The deploy target: a branch, a tag or a revision. set('target', function () { $target = ''; $branch = get('branch'); if (!empty($branch)) { $target = $branch; } if (input()->hasOption('tag') && !empty(input()->getOption('tag'))) { $target = input()->getOption('tag'); } if (input()->hasOption('revision') && !empty(input()->getOption('revision'))) { $target = input()->getOption('revision'); } if (empty($target)) { $target = "HEAD"; } return $target; }); task('deploy:prepare', [ 'deploy:info', 'deploy:setup', 'deploy:lock', 'deploy:release', 'deploy:update_code', 'deploy:shared', 'deploy:writable', ]); task('deploy:publish', [ 'deploy:symlink', 'deploy:unlock', 'deploy:cleanup', 'deploy:success', ]); /** * Prints success message */ task('deploy:success', function () { info('successfully deployed!'); }) ->shallow() ->hidden(); /** * Hook on deploy failure. */ task('deploy:failed', function () { })->hidden(); fail('deploy', 'deploy:failed'); /** * Follow latest application logs. */ desc('Follow latest application logs.'); task('logs', function () { if (!has('log_files')) { warning("Please, specify \"log_files\" option."); return; } if (output()->getVerbosity() === Output::VERBOSITY_NORMAL) { output()->setVerbosity(Output::VERBOSITY_VERBOSE); } cd('{{current_path}}'); run('tail -f {{log_files}}'); });