Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Sync exclude option now takes a string or an array of strings.

  • Loading branch information...
commit 2c07817704393b54f72dc3ff6f7486f23d9dfa8c 1 parent 5f07fd9
@hnakamur hnakamur authored committed
Showing with 11 additions and 1 deletion.
  1. +11 −1 lib/Rex/Commands/Rsync.pm
View
12 lib/Rex/Commands/Rsync.pm
@@ -61,6 +61,12 @@ This function executes rsync to sync $source and $dest.
};
};
+ task "sync", "server01", sub {
+ sync "html/*", "/var/www/html", {
+ exclude => ["*.sw*", "*.tmp"]
+ };
+ };
+
=item DOWNLOAD - Will download all from the remote directory I</var/www/html> to the local directory I<html>.
task "sync", "server01", sub {
@@ -79,7 +85,11 @@ sub sync {
my $params = "";
if($opt && exists $opt->{'exclude'}) {
- $params .= " --exclude=" . $opt->{'exclude'};
+ my $excludes = $opt->{'exclude'};
+ $excludes = [$excludes] unless ref($excludes) eq "ARRAY";
+ for my $exclude (@$excludes) {
+ $params .= " --exclude=" . $exclude;
+ }
}
if($opt && exists $opt->{'download'} && $opt->{'download'} == 1) {
Please sign in to comment.
Something went wrong with that request. Please try again.