line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
16
|
|
|
16
|
|
13233
|
use 5.010001; |
|
16
|
|
|
|
|
81
|
|
2
|
16
|
|
|
16
|
|
125
|
use strict; |
|
16
|
|
|
|
|
60
|
|
|
16
|
|
|
|
|
520
|
|
3
|
16
|
|
|
16
|
|
134
|
use warnings; |
|
16
|
|
|
|
|
66
|
|
|
16
|
|
|
|
|
979
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Mite::App::Command::preview; |
6
|
16
|
|
|
16
|
|
147
|
use Mite::Miteception -all; |
|
16
|
|
|
|
|
70
|
|
|
16
|
|
|
|
|
248
|
|
7
|
|
|
|
|
|
|
extends qw(Mite::App::Command); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
10
|
|
|
|
|
|
|
our $VERSION = '0.012000'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub abstract { |
13
|
16
|
|
|
16
|
0
|
85
|
return "Preview the .mite.pm for a file."; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
around _build_kingpin_command => sub { |
17
|
|
|
|
|
|
|
my ( $next, $self, @args ) = @_; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $command = $self->$next( @args ); |
20
|
|
|
|
|
|
|
$command->arg( 'file', 'Path to file to preview.' )->required->existing_file; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
return $command; |
23
|
|
|
|
|
|
|
}; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub execute { |
26
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
27
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
return 0 if $self->should_exit_quietly; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
my $file = $self->kingpin_command->args->get( 'file' )->value; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my $project = $self->project; |
33
|
0
|
|
|
|
|
|
$project->load_directory; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
$project->load_files( [ $file ], '.' ) |
36
|
0
|
0
|
|
|
|
|
unless $project->sources->{$file}; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $source = $project->source_for( $file ); |
39
|
0
|
|
|
|
|
|
print $source->compile; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
return 0; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |