deployer icon indicating copy to clipboard operation
deployer copied to clipboard

The rsync array options should be merged with defaults

Open alexander-schranz opened this issue 2 years ago • 2 comments

  • Deployer version: 7.0.0-rc3

  • Deployment OS: Mac OSX Monterey

    Please, provide a minimal reproducible example of deploy.php
    

https://deployer.org/docs/7.x/contrib/rsync

When defining rsync options only with exclude:

set('rsync',[
    'exclude' => [
        '.git',
        'deploy.php',
        'assets',
    ],
]);

The deploy will fail:

[49.12.78.161]  ErrorException  in rsync.php on line 257:
[49.12.78.161]
[49.12.78.161]   Undefined array key "flags"
[49.12.78.161]

Not sure if it would be possible to define defaults somewhere else so I need not configure all rsync options.

PS: I hope its fine that I created seperate issues and not did pack all into one big issue.

alexander-schranz avatar Jan 10 '22 00:01 alexander-schranz

Can't you do:

set('rsync', function () {
  return array_merge(get('rsync'), [
    'exclude' => [
      '.git',
      'deploy.php',
    ],
  ]);
});

coreyworrell avatar Aug 09 '22 20:08 coreyworrell

Hello, Same issue when importing in the deploy.php a yml file with custom conf Placing it in the dpeloy.php makes no sens as the list of excluded files can changed from projects to another.

    rsync:
      exclude:
        - '.git*'
        - .bundler
        - deploy.php

We are obliged to put the whole thing

    rsync:
      exclude:
        - '.git*'
        - .bundler
        - deploy.php
           flags: 'rzcE'
      options: ['delete', 'delete-after', 'force']
      timeout: 3600
      include: []
      filter: []
      exclude-file: false
      include-file: false
      filter-file: false
      filter-perdir: false

nvision-luxembourg avatar Aug 11 '22 14:08 nvision-luxembourg