@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * Silverstripe configuration |
10 | 10 | */ |
11 | 11 | |
12 | -set('shared_assets', function () { |
|
12 | +set('shared_assets', function() { |
|
13 | 13 | if (test('[ -d {{release_or_current_path}}/public ]') || test('[ -d {{deploy_path}}/shared/public ]')) { |
14 | 14 | return 'public/assets'; |
15 | 15 | } |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | ]); |
29 | 29 | |
30 | 30 | // Silverstripe cli script |
31 | -set('silverstripe_cli_script', function () { |
|
31 | +set('silverstripe_cli_script', function() { |
|
32 | 32 | $paths = [ |
33 | 33 | 'framework/cli-script.php', |
34 | 34 | 'vendor/silverstripe/framework/cli-script.php' |
35 | 35 | ]; |
36 | 36 | foreach ($paths as $path) { |
37 | - if (test('[ -f {{release_or_current_path}}/'.$path.' ]')) { |
|
37 | + if (test('[ -f {{release_or_current_path}}/' . $path . ' ]')) { |
|
38 | 38 | return $path; |
39 | 39 | } |
40 | 40 | } |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | * Helper tasks |
45 | 45 | */ |
46 | 46 | desc('Runs /dev/build'); |
47 | -task('silverstripe:build', function () { |
|
47 | +task('silverstripe:build', function() { |
|
48 | 48 | run('{{bin/php}} {{release_or_current_path}}/{{silverstripe_cli_script}} /dev/build'); |
49 | 49 | }); |
50 | 50 | |
51 | 51 | desc('Runs /dev/build?flush=all'); |
52 | -task('silverstripe:buildflush', function () { |
|
52 | +task('silverstripe:buildflush', function() { |
|
53 | 53 | run('{{bin/php}} {{release_or_current_path}}/{{silverstripe_cli_script}} /dev/build flush=all'); |
54 | 54 | }); |
55 | 55 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * Apply database migrations |
23 | 23 | */ |
24 | 24 | desc('Applies database migrations'); |
25 | -task('deploy:run_migrations', function () { |
|
25 | +task('deploy:run_migrations', function() { |
|
26 | 26 | run('FLOW_CONTEXT={{flow_context}} {{bin/php}} {{release_or_current_path}}/{{flow_command}} doctrine:migrate'); |
27 | 27 | }); |
28 | 28 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * Publish resources |
31 | 31 | */ |
32 | 32 | desc('Publishes resources'); |
33 | -task('deploy:publish_resources', function () { |
|
33 | +task('deploy:publish_resources', function() { |
|
34 | 34 | run('FLOW_CONTEXT={{flow_context}} {{bin/php}} {{release_or_current_path}}/{{flow_command}} resource:publish'); |
35 | 35 | }); |
36 | 36 |
@@ -2,7 +2,7 @@ |
||
2 | 2 | namespace Deployer; |
3 | 3 | |
4 | 4 | desc('Prepares host for deploy'); |
5 | -task('deploy:setup', function () { |
|
5 | +task('deploy:setup', function() { |
|
6 | 6 | run(<<<EOF |
7 | 7 | [ -d {{deploy_path}} ] || mkdir -p {{deploy_path}}; |
8 | 8 | cd {{deploy_path}}; |
@@ -5,7 +5,7 @@ |
||
5 | 5 | set('cleanup_use_sudo', false); |
6 | 6 | |
7 | 7 | desc('Cleanup old releases'); |
8 | -task('deploy:cleanup', function () { |
|
8 | +task('deploy:cleanup', function() { |
|
9 | 9 | $releases = get('releases_list'); |
10 | 10 | $keep = get('keep_releases'); |
11 | 11 | $sudo = get('cleanup_use_sudo') ? 'sudo' : ''; |
@@ -6,7 +6,7 @@ |
||
6 | 6 | set('copy_dirs', []); |
7 | 7 | |
8 | 8 | desc('Copies directories'); |
9 | -task('deploy:copy_dirs', function () { |
|
9 | +task('deploy:copy_dirs', function() { |
|
10 | 10 | if (has('previous_release')) { |
11 | 11 | foreach (get('copy_dirs') as $dir) { |
12 | 12 | // Make sure all path without tailing slash. |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | // Used in `chown` and `acl` modes of {{writable_mode}}. |
6 | 6 | // Attempts automatically to detect http user in process list. |
7 | 7 | |
8 | -set('http_user', function () { |
|
8 | +set('http_user', function() { |
|
9 | 9 | $candidates = explode("\n", run("ps axo comm,user | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | sort | awk '{print \$NF}' | uniq")); |
10 | 10 | $httpUser = array_shift($candidates); |
11 | 11 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | // Used to make a writable directory by a server. |
23 | 23 | // Used in `chgrp` mode of {{writable_mode}} only. |
24 | 24 | // Attempts automatically to detect http user in process list. |
25 | -set('http_group', function () { |
|
25 | +set('http_group', function() { |
|
26 | 26 | $candidates = explode("\n", run("ps axo comm,group | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | sort | awk '{print \$NF}' | uniq")); |
27 | 27 | $httpGroup = array_shift($candidates); |
28 | 28 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | set('writable_chmod_mode', '0755'); |
59 | 59 | |
60 | 60 | desc('Makes writable dirs'); |
61 | -task('deploy:writable', function () { |
|
61 | +task('deploy:writable', function() { |
|
62 | 62 | $dirs = join(' ', get('writable_dirs')); |
63 | 63 | $mode = get('writable_mode'); |
64 | 64 | $recursive = get('writable_recursive') ? '-R' : ''; |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | } elseif ($mode === 'sticky') { |
134 | 134 | // Changes the group of the files, sets sticky bit to the directories |
135 | 135 | // and add the writable bit for all files |
136 | - run("for dir in $dirs;". |
|
137 | - 'do '. |
|
138 | - 'chgrp -L -R {{http_group}} ${dir}; '. |
|
139 | - 'find ${dir} -type d -exec chmod g+rwxs \{\} \;;'. |
|
140 | - 'find ${dir} -type f -exec chmod g+rw \{\} \;;'. |
|
136 | + run("for dir in $dirs;" . |
|
137 | + 'do ' . |
|
138 | + 'chgrp -L -R {{http_group}} ${dir}; ' . |
|
139 | + 'find ${dir} -type d -exec chmod g+rwxs \{\} \;;' . |
|
140 | + 'find ${dir} -type f -exec chmod g+rw \{\} \;;' . |
|
141 | 141 | 'done'); |
142 | 142 | } elseif ($mode === 'skip') { |
143 | 143 | // Does nothing, saves time if no changes are required for some environments |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | use Deployer\Exception\GracefulShutdownException; |
5 | 5 | |
6 | 6 | desc('Locks deploy'); |
7 | -task('deploy:lock', function () { |
|
7 | +task('deploy:lock', function() { |
|
8 | 8 | $user = escapeshellarg(get('user')); |
9 | 9 | $locked = run("[ -f {{deploy_path}}/.dep/deploy.lock ] && echo +locked || echo $user > {{deploy_path}}/.dep/deploy.lock"); |
10 | 10 | if ($locked === '+locked') { |
@@ -17,12 +17,12 @@ discard block |
||
17 | 17 | }); |
18 | 18 | |
19 | 19 | desc('Unlocks deploy'); |
20 | -task('deploy:unlock', function () { |
|
21 | - run("rm -f {{deploy_path}}/.dep/deploy.lock");//always success |
|
20 | +task('deploy:unlock', function() { |
|
21 | + run("rm -f {{deploy_path}}/.dep/deploy.lock"); //always success |
|
22 | 22 | }); |
23 | 23 | |
24 | 24 | desc('Checks if deploy is locked'); |
25 | -task('deploy:is_locked', function () { |
|
25 | +task('deploy:is_locked', function() { |
|
26 | 26 | $locked = test("[ -f {{deploy_path}}/.dep/deploy.lock ]"); |
27 | 27 | if ($locked) { |
28 | 28 | $lockedUser = run("cat {{deploy_path}}/.dep/deploy.lock"); |
@@ -7,7 +7,7 @@ |
||
7 | 7 | // Cancel deployment if there would be no change to the codebase. |
8 | 8 | // This avoids unnecessary releases if the latest commit has already been deployed. |
9 | 9 | desc('Checks remote head'); |
10 | -task('deploy:check_remote', function () { |
|
10 | +task('deploy:check_remote', function() { |
|
11 | 11 | $repository = get('repository'); |
12 | 12 | |
13 | 13 | // Skip if there is no current deployment to compare |
@@ -2,7 +2,7 @@ |
||
2 | 2 | namespace Deployer; |
3 | 3 | |
4 | 4 | desc('Displays info about deployment'); |
5 | -task('deploy:info', function () { |
|
5 | +task('deploy:info', function() { |
|
6 | 6 | $releaseName = test('[ -d {{deploy_path}}/.dep ]') ? get('release_name') : 1; |
7 | 7 | |
8 | 8 | info("deploying <fg=magenta;options=bold>{{target}}</> (release <fg=magenta;options=bold>{$releaseName}</>)"); |