forked from deployphp/deployer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsymfony.php
63 lines (49 loc) · 1.36 KB
/
symfony.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
namespace Deployer;
require_once __DIR__ . '/common.php';
add('recipes', ['symfony']);
set('symfony_version', function () {
$result = run('{{bin/console}} --version');
preg_match_all('/(\d+\.?)+/', $result, $matches);
return $matches[0][0] ?? 5.0;
});
set('shared_dirs', [
'var/log',
'var/sessions']
);
set('shared_files', [
'.env.local.php',
'.env.local'
]);
set('writable_dirs', [
'var'
]);
set('migrations_config', '');
set('bin/console', '{{bin/php}} {{release_path}}/bin/console');
set('console_options', function () {
return '--no-interaction';
});
desc('Migrate database');
task('database:migrate', function () {
$options = '--allow-no-migration';
if (get('migrations_config') !== '') {
$options = "$options --configuration={{release_path}}/{{migrations_config}}";
}
run("cd {{release_path}} && {{bin/console}} doctrine:migrations:migrate $options {{console_options}}");
});
desc('Clear cache');
task('deploy:cache:clear', function () {
run('{{bin/console}} cache:clear {{console_options}} --no-warmup');
});
desc('Warm up cache');
task('deploy:cache:warmup', function () {
run('{{bin/console}} cache:warmup {{console_options}}');
});
desc('Deploy project');
task('deploy', [
'deploy:prepare',
'deploy:vendors',
'deploy:cache:clear',
'deploy:cache:warmup',
'deploy:publish',
]);