@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | /** |
13 | 13 | * Get current git HEAD branch as default branch to deploy. |
14 | 14 | */ |
15 | -set('branch', function () { |
|
15 | +set('branch', function() { |
|
16 | 16 | try { |
17 | 17 | $branch = runLocally('git rev-parse --abbrev-ref HEAD'); |
18 | 18 | } catch (\Throwable $exception) { |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * Faster cloning by borrowing objects from existing clones. |
37 | 37 | */ |
38 | -set('git_cache', function () { |
|
38 | +set('git_cache', function() { |
|
39 | 39 | $gitVersion = run('{{bin/git}} version'); |
40 | 40 | $regs = []; |
41 | 41 | if (preg_match('/((\d+\.?)+)/', $gitVersion, $regs)) { |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | }); |
48 | 48 | |
49 | 49 | desc('Update code'); |
50 | -task('deploy:update_code', function () { |
|
50 | +task('deploy:update_code', function() { |
|
51 | 51 | $repository = get('repository'); |
52 | 52 | $branch = get('branch'); |
53 | 53 | $git = get('bin/git'); |
@@ -10,7 +10,7 @@ |
||
10 | 10 | use Deployer\Exception\Exception; |
11 | 11 | |
12 | 12 | desc('Creating symlinks for shared files and dirs'); |
13 | -task('deploy:shared', function () { |
|
13 | +task('deploy:shared', function() { |
|
14 | 14 | $sharedPath = "{{deploy_path}}/shared"; |
15 | 15 | |
16 | 16 | // Validate shared_dir, find duplicates |
@@ -45,33 +45,33 @@ |
||
45 | 45 | |
46 | 46 | // Tasks |
47 | 47 | desc('Compile magento di'); |
48 | -task('magento:compile', function () { |
|
48 | +task('magento:compile', function() { |
|
49 | 49 | run("{{bin/php}} {{release_path}}/bin/magento setup:di:compile"); |
50 | 50 | run('cd {{release_path}} && {{bin/composer}} dump-autoload -o'); |
51 | 51 | }); |
52 | 52 | |
53 | 53 | desc('Deploy assets'); |
54 | -task('magento:deploy:assets', function () { |
|
54 | +task('magento:deploy:assets', function() { |
|
55 | 55 | run("{{bin/php}} {{release_path}}/bin/magento setup:static-content:deploy {{static_content_locales}}"); |
56 | 56 | }); |
57 | 57 | |
58 | 58 | desc('Enable maintenance mode'); |
59 | -task('magento:maintenance:enable', function () { |
|
59 | +task('magento:maintenance:enable', function() { |
|
60 | 60 | run("if [ -d $(echo {{deploy_path}}/current) ]; then {{bin/php}} {{deploy_path}}/current/bin/magento maintenance:enable; fi"); |
61 | 61 | }); |
62 | 62 | |
63 | 63 | desc('Disable maintenance mode'); |
64 | -task('magento:maintenance:disable', function () { |
|
64 | +task('magento:maintenance:disable', function() { |
|
65 | 65 | run("if [ -d $(echo {{deploy_path}}/current) ]; then {{bin/php}} {{deploy_path}}/current/bin/magento maintenance:disable; fi"); |
66 | 66 | }); |
67 | 67 | |
68 | 68 | desc('Upgrade magento database'); |
69 | -task('magento:upgrade:db', function () { |
|
69 | +task('magento:upgrade:db', function() { |
|
70 | 70 | run("{{bin/php}} {{release_path}}/bin/magento setup:upgrade --keep-generated"); |
71 | 71 | }); |
72 | 72 | |
73 | 73 | desc('Flush Magento Cache'); |
74 | -task('magento:cache:flush', function () { |
|
74 | +task('magento:cache:flush', function() { |
|
75 | 75 | run("{{bin/php}} {{release_path}}/bin/magento cache:flush"); |
76 | 76 | }); |
77 | 77 |
@@ -8,25 +8,25 @@ |
||
8 | 8 | |
9 | 9 | add('writable_dirs', ['var/indexes', 'var/sitemaps', 'var/uploads', 'web/uploads']); |
10 | 10 | |
11 | -set('bin/websiteconsole', function () { |
|
11 | +set('bin/websiteconsole', function() { |
|
12 | 12 | return parse('{{bin/php}} {{release_path}}/bin/websiteconsole --no-interaction'); |
13 | 13 | }); |
14 | 14 | |
15 | 15 | desc('Migrate PHPCR'); |
16 | 16 | task( |
17 | 17 | 'phpcr:migrate', |
18 | - function () { |
|
18 | + function() { |
|
19 | 19 | run('{{bin/php}} {{bin/console}} phpcr:migrations:migrate {{console_options}}'); |
20 | 20 | } |
21 | 21 | ); |
22 | 22 | |
23 | 23 | desc('Clear cache'); |
24 | -task('deploy:website:cache:clear', function () { |
|
24 | +task('deploy:website:cache:clear', function() { |
|
25 | 25 | run('{{bin/websiteconsole}} cache:clear {{console_options}} --no-warmup'); |
26 | 26 | }); |
27 | 27 | |
28 | 28 | desc('Warm up cache'); |
29 | -task('deploy:website:cache:warmup', function () { |
|
29 | +task('deploy:website:cache:warmup', function() { |
|
30 | 30 | run('{{bin/websiteconsole}} cache:warmup {{console_options}}'); |
31 | 31 | }); |
32 | 32 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * Silverstripe configuration |
9 | 9 | */ |
10 | 10 | |
11 | -set('shared_assets', function () { |
|
11 | +set('shared_assets', function() { |
|
12 | 12 | if (test('[ -d {{release_path}}/public ]') || test('[ -d {{deploy_path}}/shared/public ]')) { |
13 | 13 | return 'public/assets'; |
14 | 14 | } |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | ]); |
28 | 28 | |
29 | 29 | // Silverstripe cli script |
30 | -set('silverstripe_cli_script', function () { |
|
30 | +set('silverstripe_cli_script', function() { |
|
31 | 31 | $paths = [ |
32 | 32 | 'framework/cli-script.php', |
33 | 33 | 'vendor/silverstripe/framework/cli-script.php' |
34 | 34 | ]; |
35 | 35 | foreach ($paths as $path) { |
36 | - if (test('[ -f {{release_path}}/'.$path.' ]')) { |
|
36 | + if (test('[ -f {{release_path}}/' . $path . ' ]')) { |
|
37 | 37 | return $path; |
38 | 38 | } |
39 | 39 | } |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | /** |
43 | 43 | * Helper tasks |
44 | 44 | */ |
45 | -task('silverstripe:build', function () { |
|
45 | +task('silverstripe:build', function() { |
|
46 | 46 | return run('{{bin/php}} {{release_path}}/{{silverstripe_cli_script}} /dev/build'); |
47 | 47 | })->desc('Run /dev/build'); |
48 | 48 | |
49 | -task('silverstripe:buildflush', function () { |
|
49 | +task('silverstripe:buildflush', function() { |
|
50 | 50 | return run('{{bin/php}} {{release_path}}/{{silverstripe_cli_script}} /dev/build flush=all'); |
51 | 51 | })->desc('Run /dev/build?flush=all'); |
52 | 52 |
@@ -11,30 +11,30 @@ |
||
11 | 11 | |
12 | 12 | set('shared_files', ['config/settings.inc.php', '.htaccess']); |
13 | 13 | set('shared_dirs', [ |
14 | - 'img', |
|
15 | - 'log', |
|
16 | - 'download', |
|
17 | - 'upload', |
|
18 | - 'translations', |
|
19 | - 'mails', |
|
20 | - 'themes/default-bootstrap/lang', |
|
21 | - 'themes/default-bootstrap/mails', |
|
22 | - 'themes/default-bootstrap/pdf/lang', |
|
14 | + 'img', |
|
15 | + 'log', |
|
16 | + 'download', |
|
17 | + 'upload', |
|
18 | + 'translations', |
|
19 | + 'mails', |
|
20 | + 'themes/default-bootstrap/lang', |
|
21 | + 'themes/default-bootstrap/mails', |
|
22 | + 'themes/default-bootstrap/pdf/lang', |
|
23 | 23 | ] |
24 | 24 | ); |
25 | 25 | set('writable_dirs', [ |
26 | - 'img', |
|
27 | - 'log', |
|
28 | - 'cache', |
|
29 | - 'download', |
|
30 | - 'upload', |
|
31 | - 'translations', |
|
32 | - 'mails', |
|
33 | - 'themes/default-bootstrap/lang', |
|
34 | - 'themes/default-bootstrap/mails', |
|
35 | - 'themes/default-bootstrap/pdf/lang', |
|
36 | - 'themes/default-bootstrap/cache', |
|
37 | - ] |
|
26 | + 'img', |
|
27 | + 'log', |
|
28 | + 'cache', |
|
29 | + 'download', |
|
30 | + 'upload', |
|
31 | + 'translations', |
|
32 | + 'mails', |
|
33 | + 'themes/default-bootstrap/lang', |
|
34 | + 'themes/default-bootstrap/mails', |
|
35 | + 'themes/default-bootstrap/pdf/lang', |
|
36 | + 'themes/default-bootstrap/cache', |
|
37 | + ] |
|
38 | 38 | ); |
39 | 39 | |
40 | 40 | task('deploy', [ |
@@ -27,14 +27,14 @@ |
||
27 | 27 | /** |
28 | 28 | * Create plugins' symlinks |
29 | 29 | */ |
30 | -task('deploy:init', function () { |
|
30 | +task('deploy:init', function() { |
|
31 | 31 | run('{{release_path}}/bin/cake plugin assets symlink'); |
32 | 32 | })->desc('Initialization'); |
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Run migrations |
36 | 36 | */ |
37 | -task('deploy:run_migrations', function () { |
|
37 | +task('deploy:run_migrations', function() { |
|
38 | 38 | run('{{release_path}}/bin/cake migrations migrate'); |
39 | 39 | run('{{release_path}}/bin/cake orm_cache clear'); |
40 | 40 | run('{{release_path}}/bin/cake orm_cache build'); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * Facts |
33 | 33 | */ |
34 | 34 | |
35 | -set('user', function () { |
|
35 | +set('user', function() { |
|
36 | 36 | if (getenv('CI') !== false) { |
37 | 37 | return 'ci'; |
38 | 38 | } |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | set('http_user', false); |
72 | 72 | set('http_group', false); |
73 | 73 | |
74 | -set('clear_paths', []); // Relative path from release_path |
|
75 | -set('clear_use_sudo', false); // Using sudo in clean commands? |
|
74 | +set('clear_paths', []); // Relative path from release_path |
|
75 | +set('clear_use_sudo', false); // Using sudo in clean commands? |
|
76 | 76 | |
77 | 77 | set('cleanup_use_sudo', false); // Using sudo in cleanup commands? |
78 | 78 | |
79 | -set('use_relative_symlink', function () { |
|
79 | +set('use_relative_symlink', function() { |
|
80 | 80 | return commandSupportsOption('ln', '--relative'); |
81 | 81 | }); |
82 | -set('use_atomic_symlink', function () { |
|
82 | +set('use_atomic_symlink', function() { |
|
83 | 83 | return commandSupportsOption('mv', '--no-target-directory'); |
84 | 84 | }); |
85 | 85 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | /** |
92 | 92 | * Return current release path. |
93 | 93 | */ |
94 | -set('current_path', function () { |
|
94 | +set('current_path', function() { |
|
95 | 95 | $link = run("readlink {{deploy_path}}/current"); |
96 | 96 | return substr($link, 0, 1) === '/' ? $link : get('deploy_path') . '/' . $link; |
97 | 97 | }); |
@@ -100,15 +100,15 @@ discard block |
||
100 | 100 | /** |
101 | 101 | * Custom bins |
102 | 102 | */ |
103 | -set('bin/php', function () { |
|
103 | +set('bin/php', function() { |
|
104 | 104 | return locateBinaryPath('php'); |
105 | 105 | }); |
106 | 106 | |
107 | -set('bin/git', function () { |
|
107 | +set('bin/git', function() { |
|
108 | 108 | return locateBinaryPath('git'); |
109 | 109 | }); |
110 | 110 | |
111 | -set('bin/composer', function () { |
|
111 | +set('bin/composer', function() { |
|
112 | 112 | if (commandExist('composer')) { |
113 | 113 | $composer = '{{bin/php}} ' . locateBinaryPath('composer'); |
114 | 114 | } |
@@ -121,11 +121,11 @@ discard block |
||
121 | 121 | return $composer; |
122 | 122 | }); |
123 | 123 | |
124 | -set('bin/symlink', function () { |
|
124 | +set('bin/symlink', function() { |
|
125 | 125 | return get('use_relative_symlink') ? 'ln -nfs --relative' : 'ln -nfs'; |
126 | 126 | }); |
127 | 127 | |
128 | -set('sudo_askpass', function () { |
|
128 | +set('sudo_askpass', function() { |
|
129 | 129 | if (test('[ -d {{deploy_path}}/.dep ]')) { |
130 | 130 | return '{{deploy_path}}/.dep/sudo_pass'; |
131 | 131 | } else { |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | /** |
162 | 162 | * Success message |
163 | 163 | */ |
164 | -task('deploy:success', function () { |
|
164 | +task('deploy:success', function() { |
|
165 | 165 | info('successfully deployed!'); |
166 | 166 | }) |
167 | 167 | ->shallow() |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | /** |
172 | 172 | * Deploy failure |
173 | 173 | */ |
174 | -task('deploy:failed', function () { |
|
174 | +task('deploy:failed', function() { |
|
175 | 175 | })->hidden(); |
176 | 176 | |
177 | 177 | fail('deploy', 'deploy:failed'); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * Follow latest application logs. |
181 | 181 | */ |
182 | 182 | desc('Follow latest application logs.'); |
183 | -task('logs', function () { |
|
183 | +task('logs', function() { |
|
184 | 184 | if (!has('log_files')) { |
185 | 185 | warning("Please, specify \"log_files\" option."); |
186 | 186 | return; |
@@ -19,7 +19,7 @@ |
||
19 | 19 | $pid = null; |
20 | 20 | // make sure function is not disabled via php.ini "disable_functions" |
21 | 21 | if (extension_loaded('pcntl') && function_exists('pcntl_fork')) { |
22 | - declare(ticks = 1); |
|
22 | + declare(ticks=1); |
|
23 | 23 | $pid = pcntl_fork(); |
24 | 24 | } |
25 | 25 |