File Coverage

blib/lib/Mite/App/Command/compile.pm
Criterion Covered Total %
statement 28 29 96.5
branch 3 4 75.0
condition n/a
subroutine 6 6 100.0
pod 0 2 0.0
total 37 41 90.2


line stmt bran cond sub pod time code
1 16     16   13161 use 5.010001;
  16         84  
2 16     16   116 use strict;
  16         56  
  16         571  
3 16     16   106 use warnings;
  16         61  
  16         833  
4              
5             package Mite::App::Command::compile;
6 16     16   171 use Mite::Miteception -all;
  16         65  
  16         153  
7             extends 'Mite::App::Command' => { -version => '0.009000' };
8              
9             our $AUTHORITY = 'cpan:TOBYINK';
10             our $VERSION = '0.012000';
11              
12             sub abstract {
13 16     16 0 71 return "Make your code ready to run.";
14             }
15              
16             sub execute {
17 5     5 0 13 my $self = shift;
18              
19 5         1897 require Mite::Attribute;
20 5         50 require Mite::Class;
21 5         26 require Mite::Config;
22 5         25 require Mite::Project;
23 5         1823 require Mite::Role;
24 5         1932 require Mite::Role::Tiny;
25 5         1806 require Mite::Signature;
26              
27 5 100       120 return 0 if $self->should_exit_quietly;
28              
29 3         336 my $project = $self->project;
30              
31             # This is a hack to force Mite::* modules which are already loaded
32             # to be loaded again so Mite can compile itself.
33             #
34 3 50       15 if ( $self->config->data->{dogfood} ) {
35 0         0 $project->_module_fakeout_namespace(
36             sprintf 'A%02d::B%02d', int(rand 100), int(rand 100)
37             );
38             }
39              
40 2         19 $project->add_mite_shim;
41 2         26 $project->load_directory;
42 2         15 $project->write_mites;
43 2         16 $project->write_mopper;
44              
45 2         21 return 0;
46             }
47              
48             1;