Skip to content

Commit

Permalink
Move the "download_verbose" property to the right place
Browse files Browse the repository at this point in the history
  • Loading branch information
yoe committed Feb 1, 2025
1 parent 3bf75a3 commit eefe437
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions lib/SReview/Files/Collection/HTTP/nginx/JSON.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ sub _probe_children {
if($res->is_success) {
foreach my $obj(@{$res->json}) {
if($obj->{type} eq "directory") {
foreach my $child(@{SReview::Files::Collection::HTTP::nginx::JSON->new(baseurl => join("/", $self->baseurl, $obj->{name}))->children}) {
foreach my $child(@{SReview::Files::Collection::HTTP::nginx::JSON->new(baseurl => join("/", $self->baseurl, $obj->{name}))->children}, download_verbose => $self->download_verbose) {
push @$return, SReview::Files::Access::HTTP->new(baseurl => $self->baseurl, relname => join('/', $obj->{name}, $child->{relname}), mtime => $child->mtime);
}
} else {
push @$return, SReview::Files::Access::HTTP->new(baseurl => $self->baseurl, relname => $obj->{name}, mtime => $parser->parse_datetime($obj->{mtime}));
push @$return, SReview::Files::Access::HTTP->new(baseurl => $self->baseurl, relname => $obj->{name}, mtime => $parser->parse_datetime($obj->{mtime}), download_verbose => $self->download_verbose);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions lib/SReview/Files/Collection/S3.pm
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ sub _probe_children {
baseurl => $self->baseurl,
mtime => DateTime::Format::ISO8601->parse_datetime($key->{last_modified}),
relname => $key->{key},
download_verbose => $self->download_verbose
);
}
};
Expand Down
4 changes: 2 additions & 2 deletions lib/SReview/Files/Collection/SFTP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ sub _probe_children {
next if($file->{name} eq '..');
if(S_ISDIR($file->{mode})) {
eval {
push @$return, @{SReview::Files::Collection::SFTP->new(baseurl => $self->baseurl . "/" . $file->{name}, sftpobject => $self->sftpobject)->children};
push @$return, @{SReview::Files::Collection::SFTP->new(baseurl => $self->baseurl . "/" . $file->{name}, sftpobject => $self->sftpobject, download_verbose => $self->download_verbose)->children};
};
if($@) {
if($@->isa("Moose::Exception::ValidationFailedForInlineTypeConstraint")) {
Expand All @@ -192,7 +192,7 @@ sub _probe_children {
die $@;
}
} else {
push @$return, SReview::Files::Access::SFTP->new(baseurl => $self->baseurl, relname => $file->{name}, sftpobject => $self->sftpobject);
push @$return, SReview::Files::Access::SFTP->new(baseurl => $self->baseurl, relname => $file->{name}, sftpobject => $self->sftpobject, download_verbose => $self->download_verbose);
}
}
};
Expand Down
16 changes: 8 additions & 8 deletions lib/SReview/Files/Factory.pm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ has 'url' => (
builder => '_probe_url',
);

has 'download_verbose' => (
is => 'rw',
isa => 'Bool',
default => 0,
);

no Moose;

package SReview::Files::Access::Base;
Expand Down Expand Up @@ -197,12 +203,6 @@ has 'fileclass' => (
required => 1,
);

has 'download_verbose' => (
is => 'rw',
isa => 'Bool',
default => 0,
);

has 'collection_name' => (
isa => 'Str',
is => 'ro',
Expand Down Expand Up @@ -363,13 +363,13 @@ sub _probe_children {
foreach my $file(glob($self->globpattern)) {
my $child;
if(-d $file) {
$child = SReview::Files::Collection::direct->new(baseurl => join("/", $self->baseurl, basename($file)));
$child = SReview::Files::Collection::direct->new(baseurl => join("/", $self->baseurl, basename($file)), download_verbose => $self->download_verbos);
} else {
my $basename = substr($file, length($self->baseurl));
while(substr($basename, 0, 1) eq '/') {
$basename = substr($basename, 1);
}
$child = SReview::Files::Access::direct->new(baseurl => $self->baseurl, relname => $basename);
$child = SReview::Files::Access::direct->new(baseurl => $self->baseurl, relname => $basename, download_verbose => $self->download_verbose);
}
push @return, $child;
}
Expand Down

0 comments on commit eefe437

Please sign in to comment.