@@ -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 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // Returns Composer binary path in found. Otherwise try to install latest |
9 | 9 | // composer version to `.dep/composer.phar`. To use specific composer version |
10 | 10 | // download desired phar and place it at `.dep/composer.phar`. |
11 | -set('bin/composer', function () { |
|
11 | +set('bin/composer', function() { |
|
12 | 12 | if (test('[ -f {{deploy_path}}/.dep/composer.phar ]')) { |
13 | 13 | return '{{bin/php}} {{deploy_path}}/.dep/composer.phar'; |
14 | 14 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | }); |
25 | 25 | |
26 | 26 | desc('Installs vendors'); |
27 | -task('deploy:vendors', function () { |
|
27 | +task('deploy:vendors', function() { |
|
28 | 28 | if (!commandExist('unzip')) { |
29 | 29 | warning('To speed up composer installation setup "unzip" command with PHP zip extension.'); |
30 | 30 | } |
@@ -5,7 +5,7 @@ |
||
5 | 5 | // And applies to current_path. Push can be done many times. |
6 | 6 | // The task purpose to be used only for development. |
7 | 7 | desc('Pushes local changes to remote host'); |
8 | -task('push', function () { |
|
8 | +task('push', function() { |
|
9 | 9 | $files = explode("\n", runLocally("git diff --name-only HEAD")); |
10 | 10 | |
11 | 11 | info('uploading:'); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | option('branch', null, InputOption::VALUE_REQUIRED, 'Branch to deploy'); |
16 | 16 | |
17 | 17 | // The deploy target: a branch, a tag or a revision. |
18 | -set('target', function () { |
|
18 | +set('target', function() { |
|
19 | 19 | $target = ''; |
20 | 20 | |
21 | 21 | $branch = get('branch'); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * Update code at {{release_path}} on host. |
69 | 69 | */ |
70 | 70 | desc('Updates code'); |
71 | -task('deploy:update_code', function () { |
|
71 | +task('deploy:update_code', function() { |
|
72 | 72 | $git = get('bin/git'); |
73 | 73 | $repository = get('repository'); |
74 | 74 | $target = get('target'); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * ``` |
17 | 17 | * ::: |
18 | 18 | */ |
19 | -set('rollback_candidate', function () { |
|
19 | +set('rollback_candidate', function() { |
|
20 | 20 | $currentRelease = basename(run('readlink {{current_path}}')); |
21 | 21 | $releases = get('releases_list'); |
22 | 22 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * ``` |
60 | 60 | * ::: |
61 | 61 | */ |
62 | -task('rollback', function () { |
|
62 | +task('rollback', function() { |
|
63 | 63 | cd('{{deploy_path}}'); |
64 | 64 | |
65 | 65 | $currentRelease = basename(run('readlink {{current_path}}')); |
@@ -19,7 +19,7 @@ |
||
19 | 19 | set('shared_files', []); |
20 | 20 | |
21 | 21 | desc('Creates symlinks for shared files and dirs'); |
22 | -task('deploy:shared', function () { |
|
22 | +task('deploy:shared', function() { |
|
23 | 23 | $sharedPath = "{{deploy_path}}/shared"; |
24 | 24 | |
25 | 25 | // Validate shared_dir, find duplicates |
@@ -6,22 +6,22 @@ discard block |
||
6 | 6 | use function Deployer\Support\escape_shell_argument; |
7 | 7 | |
8 | 8 | // The name of the release. |
9 | -set('release_name', function () { |
|
10 | - return within('{{deploy_path}}', function () { |
|
9 | +set('release_name', function() { |
|
10 | + return within('{{deploy_path}}', function() { |
|
11 | 11 | $latest = run('cat .dep/latest_release || echo 0'); |
12 | 12 | return strval(intval($latest) + 1); |
13 | 13 | }); |
14 | 14 | }); |
15 | 15 | |
16 | 16 | // Holds releases log from `.dep/releases_log` file. |
17 | -set('releases_log', function () { |
|
17 | +set('releases_log', function() { |
|
18 | 18 | cd('{{deploy_path}}'); |
19 | 19 | |
20 | 20 | if (!test('[ -f .dep/releases_log ]')) { |
21 | 21 | return []; |
22 | 22 | } |
23 | 23 | |
24 | - $releaseLogs = array_map(function ($line) { |
|
24 | + $releaseLogs = array_map(function($line) { |
|
25 | 25 | return json_decode($line, true); |
26 | 26 | }, explode("\n", run('tail -n 300 .dep/releases_log'))); |
27 | 27 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | }); |
30 | 30 | |
31 | 31 | // Return list of release names on host. |
32 | -set('releases_list', function () { |
|
32 | +set('releases_list', function() { |
|
33 | 33 | cd('{{deploy_path}}'); |
34 | 34 | |
35 | 35 | // If there is no releases return empty list. |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | // Will list only dirs in releases. |
41 | 41 | $ll = explode("\n", run('cd releases && ls -t -1 -d */')); |
42 | - $ll = array_map(function ($release) { |
|
42 | + $ll = array_map(function($release) { |
|
43 | 43 | return basename(rtrim(trim($release), '/')); |
44 | 44 | }, $ll); |
45 | 45 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | }); |
57 | 57 | |
58 | 58 | // Return release path. |
59 | -set('release_path', function () { |
|
59 | +set('release_path', function() { |
|
60 | 60 | $releaseExists = test('[ -h {{deploy_path}}/release ]'); |
61 | 61 | if ($releaseExists) { |
62 | 62 | $link = run("readlink {{deploy_path}}/release"); |
@@ -67,20 +67,20 @@ discard block |
||
67 | 67 | }); |
68 | 68 | |
69 | 69 | // Current release revision. Usually a git hash. |
70 | -set('release_revision', function () { |
|
70 | +set('release_revision', function() { |
|
71 | 71 | return run('cat {{release_path}}/REVISION'); |
72 | 72 | }); |
73 | 73 | |
74 | 74 | // Return the release path during a deployment |
75 | 75 | // but fallback to the current path otherwise. |
76 | -set('release_or_current_path', function () { |
|
76 | +set('release_or_current_path', function() { |
|
77 | 77 | $releaseExists = test('[ -h {{deploy_path}}/release ]'); |
78 | 78 | return $releaseExists ? get('release_path') : get('current_path'); |
79 | 79 | }); |
80 | 80 | |
81 | 81 | // Clean up unfinished releases and prepare next release |
82 | 82 | desc('Prepares release'); |
83 | -task('deploy:release', function () { |
|
83 | +task('deploy:release', function() { |
|
84 | 84 | cd('{{deploy_path}}'); |
85 | 85 | |
86 | 86 | // Clean up if there is unfinished release. |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * +---------------------+-------------+----------------+--------+-----------+ |
156 | 156 | * ``` |
157 | 157 | */ |
158 | -task('releases', function () { |
|
158 | +task('releases', function() { |
|
159 | 159 | cd('{{deploy_path}}'); |
160 | 160 | |
161 | 161 | $releasesLog = get('releases_log'); |
@@ -2,12 +2,12 @@ |
||
2 | 2 | namespace Deployer; |
3 | 3 | |
4 | 4 | // Use mv -T if available. Will check automatically. |
5 | -set('use_atomic_symlink', function () { |
|
5 | +set('use_atomic_symlink', function() { |
|
6 | 6 | return commandSupportsOption('mv', '--no-target-directory'); |
7 | 7 | }); |
8 | 8 | |
9 | 9 | desc('Creates symlink to release'); |
10 | -task('deploy:symlink', function () { |
|
10 | +task('deploy:symlink', function() { |
|
11 | 11 | if (get('use_atomic_symlink')) { |
12 | 12 | run("mv -T {{deploy_path}}/release {{current_path}}"); |
13 | 13 | } else { |
@@ -8,7 +8,7 @@ |
||
8 | 8 | set('clear_use_sudo', false); |
9 | 9 | |
10 | 10 | desc('Cleanup files and/or directories'); |
11 | -task('deploy:clear_paths', function () { |
|
11 | +task('deploy:clear_paths', function() { |
|
12 | 12 | $paths = get('clear_paths'); |
13 | 13 | $sudo = get('clear_use_sudo') ? 'sudo' : ''; |
14 | 14 | $batch = 100; |