line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dancer::Plugin::Showterm; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:YANICK'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Replay terminal typescript captures |
4
|
|
|
|
|
|
|
$Dancer::Plugin::Showterm::VERSION = '0.0.2'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
695
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
7
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
720
|
use File::ShareDir::Tarball; |
|
1
|
|
|
|
|
154362
|
|
|
1
|
|
|
|
|
53
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
1027
|
use Dancer ':syntax'; |
|
1
|
|
|
|
|
225907
|
|
|
1
|
|
|
|
|
6
|
|
12
|
1
|
|
|
1
|
|
1069
|
use Dancer::Plugin; |
|
1
|
|
|
|
|
1294
|
|
|
1
|
|
|
|
|
79
|
|
13
|
1
|
|
|
1
|
|
1122
|
use Path::Tiny; |
|
1
|
|
|
|
|
10676
|
|
|
1
|
|
|
|
|
83
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
801
|
use Moo; |
|
1
|
|
|
|
|
11821
|
|
|
1
|
|
|
|
|
7
|
|
16
|
|
|
|
|
|
|
with 'MooX::Singleton'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has assets_dir => ( |
19
|
|
|
|
|
|
|
is => 'ro', |
20
|
|
|
|
|
|
|
lazy => 1, |
21
|
|
|
|
|
|
|
default => sub { |
22
|
|
|
|
|
|
|
path( |
23
|
|
|
|
|
|
|
plugin_setting->{assets_dir} |
24
|
|
|
|
|
|
|
|| File::ShareDir::Tarball::dist_dir('Dancer-Plugin-Showterm') |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
}, |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has stylesheet => ( |
30
|
|
|
|
|
|
|
is => 'ro', |
31
|
|
|
|
|
|
|
default => sub { |
32
|
|
|
|
|
|
|
plugin_setting->{stylesheet}; |
33
|
|
|
|
|
|
|
}, |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $plugin = __PACKAGE__->instance; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
get qr/.*\.showterm/ => sub { |
39
|
|
|
|
|
|
|
( my $file = request->path ) =~ s/\.showterm$/\.typescript/; |
40
|
|
|
|
|
|
|
my $template = $plugin->assets_dir->child('showterm.html')->slurp; |
41
|
|
|
|
|
|
|
$template =~ s/__FILE__/$file/g; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
$template =~ s[(?=)][ |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
] for grep { $_ } $plugin->stylesheet; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
$template; |
48
|
|
|
|
|
|
|
}; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
get qr#/showterm/(.*)# => sub { |
51
|
|
|
|
|
|
|
my( $path ) = splat; |
52
|
|
|
|
|
|
|
send_file $plugin->assets_dir->child($path), system_path => 1; |
53
|
|
|
|
|
|
|
}; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |