$dir->mkpath;
my $prefix = 'http://'.($opt->{host} || $self->host);
if (my $only = $opt->{only}) {
- my $re = qr/^\Q${only}/;
+ my $re = qr/^${only}/;
@all_paths = grep /$re/, @all_paths;
}
+ my @fail;
foreach my $path (@all_paths) {
warn "Generating ${path}\n";
+ my $res = $self->app->web->run_test_request(GET => "${prefix}${path}");
+
+ unless ($res->is_success) {
+ warn "ERROR on ${path}\n";
+ push @fail, [ $path, $res ];
+ next;
+ }
+
my $dir = $dir->catdir($path);
$dir->mkpath;
- my $res = $self->app->web->run_test_request(GET => "${prefix}${path}");
# text/html -> html
# application/atom+xml -> atom
my ($ext) = $res->content_type =~ m{\/(\w+)}
." for path ${path}";
$dir->catfile("index.${ext}")->print($res->content);
}
+ warn "\nERRORS GENERATING PAGES:\n";
+ foreach my $fail (@fail) {
+ my ($path, $res) = @$fail;
+ warn "\nFailed to generate ${path}:\n";
+ my $error = $res->content||'';
+ $error =~ s/^/ /mg;
+ $error .= "\n" unless $error =~ /\n\Z/;
+ warn $error;
+ }
}
sub run_command_staticserver {