Skip to content

Commit 46594e6

Browse files
import fix of issue Grinnz#35 empty search for sqlite backend
2 parents 31e8c88 + 68eefbb commit 46594e6

File tree

9 files changed

+396
-158
lines changed

9 files changed

+396
-158
lines changed

README.pod

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ of one or more Perls.
6262
Dan Book <dbook@cpan.org>
6363

6464
PerldocBrowser::Plugin::PerldocRenderer is a fork of the L<Mojolicious|https://mojolicious.org>
65-
team's L<Mojolicious::Plugin::PODRenderer> and its associated template.
65+
team's L<PODRenderer plugin|https://search.cpan.org/perldoc?Mojolicious::Plugin::PODRenderer> and its associated template.
6666

6767
=head1 COPYRIGHT AND LICENSE
6868

@@ -75,8 +75,5 @@ This is free software, licensed under:
7575

7676
The Artistic License 2.0 (GPL Compatible)
7777

78-
prettify.js is Copyright (c) 2006, 2013 Google Inc., licensed under the Apache
79-
License, Version 2.0 L<http://www.apache.org/licenses/LICENSE-2.0>.
80-
8178
Bundled Perl 5 Raptor is Copyright (c) 2012, Sebastian Riedel, licensed under
8279
the CC-SA License, Version 4.0 L<http://creativecommons.org/licenses/by-sa/4.0>.

cpanfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ requires 'File::pushd';
66
requires 'File::Spec';
77
requires 'File::Temp';
88
requires 'IPC::Run3';
9+
requires 'Lingua::EN::Sentence';
910
requires 'List::Util' => '1.50';
1011
requires 'MetaCPAN::Pod::XHTML';
1112
requires 'Module::Metadata';

lib/PerldocBrowser/Command/purge.pm

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package PerldocBrowser::Command::purge;
2+
3+
# This software is Copyright (c) 2018 by Dan Book <dbook@cpan.org>.
4+
# This is free software, licensed under:
5+
# The Artistic License 2.0 (GPL Compatible)
6+
7+
use 5.020;
8+
use Mojo::Base 'Mojolicious::Command';
9+
use Mojo::URL;
10+
use experimental 'signatures';
11+
12+
has description => 'Purge Fastly cache';
13+
has usage => "Usage: $0 purge [all | <path> ...]\n";
14+
15+
sub run ($self, @paths) {
16+
die $self->usage unless @paths;
17+
if ($paths[0] eq 'all') {
18+
my $api_key = $self->app->config('fastly_api_key') // die "No fastly_api_key configured\n";
19+
my $service_id = $self->app->config('fastly_service_id') // die "No fastly_service_id configured\n";
20+
my $url = Mojo::URL->new('https://api.fastly.com')->path("/service/$service_id/purge_all");
21+
my %headers = (
22+
'Fastly-Key' => $api_key,
23+
Accept => 'application/json',
24+
);
25+
my $res = $self->app->ua->post($url, \%headers)->result;
26+
print $res->body, "\n";
27+
} else {
28+
foreach my $path (@paths) {
29+
my $url = Mojo::URL->new($path);
30+
unless (length $url->host) {
31+
my $host = $self->app->config('canonical_host') // die "No canonical_host configured\n";
32+
$url->scheme('https')->host($host);
33+
}
34+
my $res = $self->app->ua->start($self->app->ua->build_tx(PURGE => $url))->result;
35+
print $res->body, "\n";
36+
}
37+
}
38+
}
39+
40+
1;

0 commit comments

Comments
 (0)