| @@ -5,7 +5,7 @@ discard block | ||
| 5 | 5 | |
| 6 | 6 |  add('recipes', ['symfony']); | 
| 7 | 7 | |
| 8 | -set('symfony_version', function () { | |
| 8 | +set('symfony_version', function() { | |
| 9 | 9 |      $result = run('{{bin/console}} --version'); | 
| 10 | 10 |      preg_match_all('/(\d+\.?)+/', $result, $matches); | 
| 11 | 11 | return $matches[0][0] ?? 5.0; | 
| @@ -34,12 +34,12 @@ discard block | ||
| 34 | 34 | |
| 35 | 35 |  set('bin/console', '{{bin/php}} {{release_or_current_path}}/bin/console'); | 
| 36 | 36 | |
| 37 | -set('console_options', function () { | |
| 37 | +set('console_options', function() { | |
| 38 | 38 | return '--no-interaction'; | 
| 39 | 39 | }); | 
| 40 | 40 | |
| 41 | 41 |  desc('Migrates database'); | 
| 42 | -task('database:migrate', function () { | |
| 42 | +task('database:migrate', function() { | |
| 43 | 43 | $options = '--allow-no-migration'; | 
| 44 | 44 |      if (get('migrations_config') !== '') { | 
| 45 | 45 |          $options = "$options --configuration={{release_or_current_path}}/{{migrations_config}}"; | 
| @@ -49,12 +49,12 @@ discard block | ||
| 49 | 49 | }); | 
| 50 | 50 | |
| 51 | 51 |  desc('Validate the Doctrine mapping files'); | 
| 52 | -task('doctrine:schema:validate', function () { | |
| 52 | +task('doctrine:schema:validate', function() { | |
| 53 | 53 |      run("cd {{release_or_current_path}} && {{bin/console}} doctrine:schema:validate {{doctrine_schema_validate_config}} {{console_options}}"); | 
| 54 | 54 | }); | 
| 55 | 55 | |
| 56 | 56 |  desc('Clears cache'); | 
| 57 | -task('deploy:cache:clear', function () { | |
| 57 | +task('deploy:cache:clear', function() { | |
| 58 | 58 | // composer install scripts usually clear and warmup symfony cache | 
| 59 | 59 | // so we only need to do it if composer install was run with --no-scripts | 
| 60 | 60 |      if (false !== strpos(get('composer_options', ''), '--no-scripts')) { | 
| @@ -63,8 +63,8 @@ discard block | ||
| 63 | 63 | }); | 
| 64 | 64 | |
| 65 | 65 |  desc('Optimize environment variables'); | 
| 66 | -task('deploy:env', function () { | |
| 67 | -    within('{{release_or_current_path}}', function () { | |
| 66 | +task('deploy:env', function() { | |
| 67 | +    within('{{release_or_current_path}}', function() { | |
| 68 | 68 |          run('{{bin/composer}} dump-env "${APP_ENV:-prod}"'); | 
| 69 | 69 | }); | 
| 70 | 70 | }); | 
| @@ -23,7 +23,7 @@ discard block | ||
| 23 | 23 | |
| 24 | 24 |  set('log_files', 'writable/logs/*.log'); | 
| 25 | 25 | |
| 26 | -set('codeigniter4_version', function () { | |
| 26 | +set('codeigniter4_version', function() { | |
| 27 | 27 |      $result = run('{{bin/php}} {{release_or_current_path}}/spark'); | 
| 28 | 28 |      preg_match_all('/(\d+\.?)+/', $result, $matches); | 
| 29 | 29 | return $matches[0][0] ?? 5.5; | 
| @@ -45,7 +45,7 @@ discard block | ||
| 45 | 45 | */ | 
| 46 | 46 | function spark($command, $options = []) | 
| 47 | 47 |  { | 
| 48 | -    return function () use ($command, $options) { | |
| 48 | +    return function() use ($command, $options) { | |
| 49 | 49 | |
| 50 | 50 | // Ensure the spark command is available on the current version. | 
| 51 | 51 |          $versionTooEarly = array_key_exists('min', $options) | 
| @@ -12,7 +12,7 @@ | ||
| 12 | 12 | 'storage/statamic', | 
| 13 | 13 | ]); | 
| 14 | 14 | |
| 15 | -set('statamic_version', function () { | |
| 15 | +set('statamic_version', function() { | |
| 16 | 16 |      $result = run('{{bin/php}} {{release_or_current_path}}/please --version'); | 
| 17 | 17 |      preg_match_all('/(\d+\.?)+/', $result, $matches); | 
| 18 | 18 | return $matches[0][0] ?? 'unknown'; | 
| @@ -16,7 +16,7 @@ discard block | ||
| 16 | 16 |  set('roadrunner_path', '{{release_or_current_path}}'); | 
| 17 | 17 | |
| 18 | 18 |  desc('Create .env file if it doesn\'t exist'); | 
| 19 | -task('deploy:environment', function (): void { | |
| 19 | +task('deploy:environment', function(): void { | |
| 20 | 20 |      run('cd {{release_or_current_path}} && [ ! -f .env ] && cp .env.sample .env'); | 
| 21 | 21 | }); | 
| 22 | 22 | |
| @@ -28,7 +28,7 @@ discard block | ||
| 28 | 28 | */ | 
| 29 | 29 | function command(string $command, array $options = []): \Closure | 
| 30 | 30 |  { | 
| 31 | -    return function () use ($command, $options): void { | |
| 31 | +    return function() use ($command, $options): void { | |
| 32 | 32 |          $output = run("cd {{release_or_current_path}} && {{bin/php}} app.php $command"); | 
| 33 | 33 | |
| 34 | 34 |          if (\in_array('showOutput', $options, true)) { | 
| @@ -45,7 +45,7 @@ discard block | ||
| 45 | 45 | */ | 
| 46 | 46 | function rr(string $command, array $options = []): \Closure | 
| 47 | 47 |  { | 
| 48 | -    return function () use ($command, $options): void { | |
| 48 | +    return function() use ($command, $options): void { | |
| 49 | 49 |          $output = run("cd {{roadrunner_path}} && ./rr $command"); | 
| 50 | 50 | |
| 51 | 51 |          if (\in_array('showOutput', $options, true)) { | 
| @@ -112,7 +112,7 @@ discard block | ||
| 112 | 112 | * RoadRunner console commands | 
| 113 | 113 | */ | 
| 114 | 114 |  desc('Start RoadRunner server'); | 
| 115 | -task('roadrunner:serve', function (): void { | |
| 115 | +task('roadrunner:serve', function(): void { | |
| 116 | 116 |      exec(parse('cd {{roadrunner_path}} && ./rr serve -p > /dev/null 2>&1 &')); | 
| 117 | 117 | }); | 
| 118 | 118 | |
| @@ -126,13 +126,13 @@ discard block | ||
| 126 | 126 | * Download and restart RoadRunner | 
| 127 | 127 | */ | 
| 128 | 128 |  desc('Download RoadRunner'); | 
| 129 | -task('deploy:download-rr', function (): void { | |
| 129 | +task('deploy:download-rr', function(): void { | |
| 130 | 130 |      $output = run("cd {{release_or_current_path}} && {{bin/php}} ./vendor/bin/rr get-binary -l {{roadrunner_path}}"); | 
| 131 | 131 |      writeln("<info>$output</info>"); | 
| 132 | 132 | }); | 
| 133 | 133 | |
| 134 | 134 |  desc('Restart RoadRunner'); | 
| 135 | -task('deploy:restart-rr', function (): void { | |
| 135 | +task('deploy:restart-rr', function(): void { | |
| 136 | 136 |      try { | 
| 137 | 137 |          invoke('roadrunner:reset'); | 
| 138 | 138 |          writeln("<info>Roadrunner successfully restarted.</info>"); | 
| @@ -24,14 +24,14 @@ | ||
| 24 | 24 | /** | 
| 25 | 25 | * Create plugins' symlinks | 
| 26 | 26 | */ | 
| 27 | -task('deploy:init', function () { | |
| 27 | +task('deploy:init', function() { | |
| 28 | 28 |      run('{{bin/php}} {{release_or_current_path}}/bin/cake.php plugin assets symlink'); | 
| 29 | 29 |  })->desc('Initialization'); | 
| 30 | 30 | |
| 31 | 31 | /** | 
| 32 | 32 | * Run migrations | 
| 33 | 33 | */ | 
| 34 | -task('deploy:run_migrations', function () { | |
| 34 | +task('deploy:run_migrations', function() { | |
| 35 | 35 |      run('{{bin/php}} {{release_or_current_path}}/bin/cake.php migrations migrate --no-lock'); | 
| 36 | 36 |      run('{{bin/php}} {{release_or_current_path}}/bin/cake.php schema_cache build'); | 
| 37 | 37 |  })->desc('Run migrations'); | 
| @@ -22,14 +22,14 @@ | ||
| 22 | 22 | * Clear cache | 
| 23 | 23 | */ | 
| 24 | 24 |  desc('Clears cache'); | 
| 25 | -task('deploy:cache:clear', function () { | |
| 25 | +task('deploy:cache:clear', function() { | |
| 26 | 26 |      run("cd {{release_or_current_path}} && php -r \"require_once 'app/Mage.php'; umask(0); Mage::app()->cleanCache();\""); | 
| 27 | 27 | }); | 
| 28 | 28 | |
| 29 | 29 | /** | 
| 30 | 30 | * Remove files that can be used to compromise Magento | 
| 31 | 31 | */ | 
| 32 | -task('deploy:clear_version', function () { | |
| 32 | +task('deploy:clear_version', function() { | |
| 33 | 33 |      run("rm -f {{release_or_current_path}}/LICENSE.html"); | 
| 34 | 34 |      run("rm -f {{release_or_current_path}}/LICENSE.txt"); | 
| 35 | 35 |      run("rm -f {{release_or_current_path}}/LICENSE_AFL.txt"); | 
| @@ -9,22 +9,22 @@ | ||
| 9 | 9 | |
| 10 | 10 |  add('writable_dirs', ['public/uploads']); | 
| 11 | 11 | |
| 12 | -set('bin/websiteconsole', function () { | |
| 12 | +set('bin/websiteconsole', function() { | |
| 13 | 13 |      return parse('{{bin/php}} {{release_or_current_path}}/bin/websiteconsole --no-interaction'); | 
| 14 | 14 | }); | 
| 15 | 15 | |
| 16 | 16 |  desc('Migrates PHPCR'); | 
| 17 | -task('phpcr:migrate', function () { | |
| 17 | +task('phpcr:migrate', function() { | |
| 18 | 18 |      run('{{bin/console}} phpcr:migrations:migrate'); | 
| 19 | 19 | }); | 
| 20 | 20 | |
| 21 | 21 |  desc('Clears cache'); | 
| 22 | -task('deploy:website:cache:clear', function () { | |
| 22 | +task('deploy:website:cache:clear', function() { | |
| 23 | 23 |      run('{{bin/websiteconsole}} cache:clear --no-warmup'); | 
| 24 | 24 | }); | 
| 25 | 25 | |
| 26 | 26 |  desc('Warmups cache'); | 
| 27 | -task('deploy:website:cache:warmup', function () { | |
| 27 | +task('deploy:website:cache:warmup', function() { | |
| 28 | 28 |      run('{{bin/websiteconsole}} cache:warmup'); | 
| 29 | 29 | }); | 
| 30 | 30 | |
| @@ -12,7 +12,7 @@ | ||
| 12 | 12 |  set('writable_dirs', ['runtime']); | 
| 13 | 13 | |
| 14 | 14 |  desc('Runs Yii2 migrations for your project'); | 
| 15 | -task('deploy:migrate', function () { | |
| 15 | +task('deploy:migrate', function() { | |
| 16 | 16 |      run('cd {{release_or_current_path}} && {{bin/php}} yii migrate --interactive=0'); | 
| 17 | 17 | }); | 
| 18 | 18 | |
| @@ -71,37 +71,37 @@ discard block | ||
| 71 | 71 | ]); | 
| 72 | 72 | |
| 73 | 73 | // This task remotely executes the `cache:clear` console command on the target server. | 
| 74 | -task('sw:cache:clear', static function () { | |
| 74 | +task('sw:cache:clear', static function() { | |
| 75 | 75 |      run('cd {{release_path}} && {{bin/console}} cache:clear --no-warmup'); | 
| 76 | 76 | }); | 
| 77 | 77 | |
| 78 | 78 | // This task remotely executes the cache warmup console commands on the target server, so that the first user, who | 
| 79 | 79 | // visits the website, doesn't have to wait for the cache to be built up. | 
| 80 | -task('sw:cache:warmup', static function () { | |
| 80 | +task('sw:cache:warmup', static function() { | |
| 81 | 81 |      run('cd {{release_path}} && {{bin/console}} cache:warmup'); | 
| 82 | 82 |      run('cd {{release_path}} && {{bin/console}} http:cache:warm:up'); | 
| 83 | 83 | }); | 
| 84 | 84 | |
| 85 | 85 | // This task remotely executes the `database:migrate` console command on the target server. | 
| 86 | -task('sw:database:migrate', static function () { | |
| 86 | +task('sw:database:migrate', static function() { | |
| 87 | 87 |      run('cd {{release_path}} && {{bin/console}} database:migrate --all'); | 
| 88 | 88 | }); | 
| 89 | 89 | |
| 90 | -task('sw:plugin:refresh', function () { | |
| 90 | +task('sw:plugin:refresh', function() { | |
| 91 | 91 |      run('cd {{release_path}} && {{bin/console}} plugin:refresh'); | 
| 92 | 92 | }); | 
| 93 | 93 | |
| 94 | -task('sw:scheduled-task:register', function () { | |
| 94 | +task('sw:scheduled-task:register', function() { | |
| 95 | 95 |      run('cd {{release_path}} && {{bin/console}} scheduled-task:register'); | 
| 96 | 96 | }); | 
| 97 | 97 | |
| 98 | -task('sw:theme:refresh', function () { | |
| 98 | +task('sw:theme:refresh', function() { | |
| 99 | 99 |      run('cd {{release_path}} && {{bin/console}} theme:refresh'); | 
| 100 | 100 | }); | 
| 101 | 101 | |
| 102 | 102 | // This task is not used per default, but can be used, e.g. in combination with `SHOPWARE_SKIP_THEME_COMPILE=1`, | 
| 103 | 103 | // to build the theme remotely instead of locally. | 
| 104 | -task('sw:theme:compile', function () { | |
| 104 | +task('sw:theme:compile', function() { | |
| 105 | 105 |      run('cd {{release_path}} && {{bin/console}} theme:compile'); | 
| 106 | 106 | }); | 
| 107 | 107 | |
| @@ -113,7 +113,7 @@ discard block | ||
| 113 | 113 | return $plugins; | 
| 114 | 114 | } | 
| 115 | 115 | |
| 116 | -task('sw:plugin:update:all', static function () { | |
| 116 | +task('sw:plugin:update:all', static function() { | |
| 117 | 117 | $plugins = getPlugins(); | 
| 118 | 118 |      foreach ($plugins as $plugin) { | 
| 119 | 119 |          if ($plugin->installedAt && $plugin->upgradeVersion) { | 
| @@ -123,7 +123,7 @@ discard block | ||
| 123 | 123 | } | 
| 124 | 124 | }); | 
| 125 | 125 | |
| 126 | -task('sw:writable:jwt', static function () { | |
| 126 | +task('sw:writable:jwt', static function() { | |
| 127 | 127 |      run('cd {{release_path}} && chmod -R 660 config/jwt/*'); | 
| 128 | 128 | }); | 
| 129 | 129 | |
| @@ -150,7 +150,7 @@ discard block | ||
| 150 | 150 | 'deploy:publish', | 
| 151 | 151 | ]); | 
| 152 | 152 | |
| 153 | -task('deploy:update_code')->setCallback(static function () { | |
| 153 | +task('deploy:update_code')->setCallback(static function() { | |
| 154 | 154 |      upload('.', '{{release_path}}', [ | 
| 155 | 155 | 'options' => [ | 
| 156 | 156 | '--exclude=.git', | 
| @@ -160,11 +160,11 @@ discard block | ||
| 160 | 160 | ]); | 
| 161 | 161 | }); | 
| 162 | 162 | |
| 163 | -task('sw-build-without-db:get-remote-config', static function () { | |
| 163 | +task('sw-build-without-db:get-remote-config', static function() { | |
| 164 | 164 |      if (!test('[ -d {{current_path}} ]')) { | 
| 165 | 165 | return; | 
| 166 | 166 | } | 
| 167 | -    within('{{deploy_path}}/current', function () { | |
| 167 | +    within('{{deploy_path}}/current', function() { | |
| 168 | 168 |          run('{{bin/php}} ./bin/console bundle:dump'); | 
| 169 | 169 |          download('{{deploy_path}}/current/var/plugins.json', './var/'); | 
| 170 | 170 | |
| @@ -173,7 +173,7 @@ discard block | ||
| 173 | 173 | }); | 
| 174 | 174 | }); | 
| 175 | 175 | |
| 176 | -task('sw-build-without-db:build', static function () { | |
| 176 | +task('sw-build-without-db:build', static function() { | |
| 177 | 177 |      runLocally('CI=1 SHOPWARE_SKIP_BUNDLE_DUMP=1 ./bin/build-js.sh'); | 
| 178 | 178 | }); | 
| 179 | 179 | |