The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Rex::Commands::PerlSync - Sync directories, better

DESCRIPTION

This module is a Rex command which synchronizes directories. It is a fork of Rex::Commands::Sync with the same interface and a couple of improvements:

  • Files and directories are now excluded before calculating md5 of the directory, vastly improving the speed if there are a lot of excluded files.

  • Excludes now work using the exact path rather than file name, making it easier to exclude files or entire directories.

SYNOPSIS

use Rex::Commands::PerlSync;

task "prepare", "mysystem01", sub {
  # upload directory recursively to remote system.
  sync_up "/local/directory", "/remote/directory";

  sync_up "/local/directory", "/remote/directory", {
    # setting custom file permissions for every file
    files => {
      owner => "foo",
      group => "bar",
      mode  => 600,
    },
    # setting custom directory permissions for every directory
    directories => {
      owner => "foo",
      group => "bar",
      mode  => 700,
    },
    exclude => [ '*.tmp' ],
    parse_templates => TRUE|FALSE,
    on_change => sub {
     my (@files_changed) = @_;
    },
  };

  # download a directory recursively from the remote system to the local machine
  sync_down "/remote/directory", "/local/directory";
};

AUTHOR

Original code from Rex - see authors.

Modified by Bartosz Jarzyna <bbrtj.pro@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2024 by Bartosz Jarzyna

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.