@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | use Deployer\Exception\RunException; |
12 | 12 | |
13 | 13 | desc('Lock deploy'); |
14 | -task('deploy:lock', function () { |
|
14 | +task('deploy:lock', function() { |
|
15 | 15 | $locked = test("[ -f {{deploy_path}}/.dep/deploy.lock ]"); |
16 | 16 | |
17 | 17 | if ($locked) { |
@@ -25,19 +25,19 @@ discard block |
||
25 | 25 | }); |
26 | 26 | |
27 | 27 | desc('Unlock deploy'); |
28 | -task('deploy:unlock', function () { |
|
29 | - run("rm -f {{deploy_path}}/.dep/deploy.lock");//always success |
|
28 | +task('deploy:unlock', function() { |
|
29 | + run("rm -f {{deploy_path}}/.dep/deploy.lock"); //always success |
|
30 | 30 | }); |
31 | 31 | |
32 | 32 | desc('Check if deploy is unlocked'); |
33 | -task('deploy:is-unlocked', function () { |
|
33 | +task('deploy:is-unlocked', function() { |
|
34 | 34 | $locked = test("[ -f {{deploy_path}}/.dep/deploy.lock ]"); |
35 | 35 | |
36 | 36 | if ($locked) { |
37 | - writeln( 'Deploy is currently locked.'); |
|
37 | + writeln('Deploy is currently locked.'); |
|
38 | 38 | |
39 | 39 | throw new GracefulShutdownException(); |
40 | 40 | } |
41 | 41 | |
42 | - writeln( 'Deploy is currently unlocked.'); |
|
42 | + writeln('Deploy is currently unlocked.'); |
|
43 | 43 | }); |
@@ -13,26 +13,26 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * Name of folder in releases. |
15 | 15 | */ |
16 | -set('release_name', function () { |
|
16 | +set('release_name', function() { |
|
17 | 17 | $list = get('releases_list'); |
18 | 18 | |
19 | 19 | // Filter out anything that does not look like a release. |
20 | - $list = array_filter($list, function ($release) { |
|
20 | + $list = array_filter($list, function($release) { |
|
21 | 21 | return preg_match('/^[\d\.]+$/', $release); |
22 | 22 | }); |
23 | 23 | |
24 | 24 | $nextReleaseNumber = 1; |
25 | 25 | if (count($list) > 0) { |
26 | - $nextReleaseNumber = (int)max($list) + 1; |
|
26 | + $nextReleaseNumber = (int) max($list) + 1; |
|
27 | 27 | } |
28 | 28 | |
29 | - return (string)$nextReleaseNumber; |
|
29 | + return (string) $nextReleaseNumber; |
|
30 | 30 | }); |
31 | 31 | |
32 | 32 | /** |
33 | 33 | * Return list of releases on host. |
34 | 34 | */ |
35 | -set('releases_list', function () { |
|
35 | +set('releases_list', function() { |
|
36 | 36 | cd('{{deploy_path}}'); |
37 | 37 | |
38 | 38 | // If there is no releases return empty list. |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $list = explode("\n", run('cd releases && ls -t -1 -d */')); |
45 | 45 | |
46 | 46 | // Prepare list. |
47 | - $list = array_map(function ($release) { |
|
47 | + $list = array_map(function($release) { |
|
48 | 48 | return basename(rtrim(trim($release), '/')); |
49 | 49 | }, $list); |
50 | 50 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | /** |
88 | 88 | * Return release path. |
89 | 89 | */ |
90 | -set('release_path', function () { |
|
90 | +set('release_path', function() { |
|
91 | 91 | $releaseExists = test('[ -h {{deploy_path}}/release ]'); |
92 | 92 | if ($releaseExists) { |
93 | 93 | $link = run("readlink {{deploy_path}}/release"); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | |
101 | 101 | desc('Prepare release. Clean up unfinished releases and prepare next release'); |
102 | -task('deploy:release', function () { |
|
102 | +task('deploy:release', function() { |
|
103 | 103 | cd('{{deploy_path}}'); |
104 | 104 | |
105 | 105 | // Clean up if there is unfinished release |
@@ -8,7 +8,7 @@ |
||
8 | 8 | namespace Deployer; |
9 | 9 | |
10 | 10 | desc('Make writable dirs'); |
11 | -task('deploy:writable', function () { |
|
11 | +task('deploy:writable', function() { |
|
12 | 12 | $dirs = join(' ', get('writable_dirs')); |
13 | 13 | $mode = get('writable_mode'); |
14 | 14 | $sudo = get('writable_use_sudo') ? 'sudo' : ''; |
@@ -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'); |