-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbolt.php
96 lines (78 loc) · 2.55 KB
/
bolt.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
namespace Deployer;
require_once 'recipe/symfony4.php';
// Config
add('recipes', ['bolt']);
add('shared_files', ['.env']);
add('shared_dirs', ['public/files', 'var/data']);
add('writable_dirs', ['public/files', 'public/thumbs', 'var/', 'config/']);
set('allow_anonymous_stats', false);
set('git_tty', false);
set('ssh_multiplexing', false);
set('vhost_symlink', null);
set('bin/console', function () {
return parse('{{release_path}}/bin/console --no-interaction');
});
set('bin/php', function () {
$bin = get('bin', []);
return isset($bin['php']) ? $bin['php'] : locateBinaryPath('php');
});
set('bin/git', function () {
$bin = get('bin', []);
return isset($bin['git']) ? $bin['git'] : locateBinaryPath('git');
});
set('bin/composer', function () {
$bin = get('bin', []);
if (isset($bin['composer'])) {
return $bin['composer'];
}
if (commandExist('composer')) {
$composer = locateBinaryPath('composer');
}
if (empty($composer)) {
run("cd {{release_path}} && curl -sS https://getcomposer.org/installer | {{bin/php}}");
$composer = '{{bin/php}} {{release_path}}/composer.phar';
}
return $composer;
});
set('branch', function () {
return input()->getOption('branch') ?: get('default_branch');
});
// Tasks
task('bolt:symlink:public', function () {
if (get('vhost_symlink')) {
run('rm -rf {{deploy_path}}/{{vhost_symlink}} && ln -s {{release_path}}/public/ {{deploy_path}}/{{vhost_symlink}}');
}
});
desc('Initialise .env');
task('bolt:init-env', function () {
run('if [ ! -s {{deploy_path}}/shared/.env ]; then cat {{release_path}}/.env.dist > {{deploy_path}}/shared/.env; fi');
});
desc('Run the "wrap up"-script');
task('bolt:wrap-up', function () {
run('if [ -x {{deploy_path}}/wrap-up.sh ]; then cd {{deploy_path}}; ./wrap-up.sh; fi');
});
desc('Run the "warm up"-script');
task('bolt:warm-up', function () {
run('if [ -x {{deploy_path}}/warm-up.sh ]; then cd {{deploy_path}}; ./warm-up.sh; fi');
});
after('deploy:failed', 'deploy:unlock');
after('deploy:symlink', 'bolt:symlink:public');
after('deploy:symlink', 'bolt:wrap-up');
after('deploy:prepare', 'bolt:warm-up');
// after('bolt:symlink:public', 'bolt:init-env');
desc('Initialise project');
task('initialise', [
'deploy:prepare',
'deploy:release',
'deploy:update_code',
'deploy:writable',
'deploy:shared',
'bolt:symlink:public',
'bolt:init-env',
]);
task('version-info', function () {
run('{{bin/php}} -v');
run('{{bin/git}} --version');
run('{{bin/composer}} --version');
});