File Coverage

lib/Mojolicious/Plugin/Module/Assets.pm
Criterion Covered Total %
statement 22 22 100.0
branch 3 4 75.0
condition 1 3 33.3
subroutine 6 6 100.0
pod 0 1 0.0
total 32 36 88.8


line stmt bran cond sub pod time code
1             package Mojolicious::Plugin::Module::Assets;
2 3     3   16 use Mojo::Base -base;
  3         6  
  3         22  
3 3     3   522 use Mojo::Util qw/decamelize/;
  3         5  
  3         147  
4 3     3   2458 use File::Copy::Recursive qw/dircopy/;
  3         13392  
  3         199  
5 3     3   19 use FindBin;
  3         15  
  3         127  
6 3     3   15 use Carp;
  3         5  
  3         656  
7              
8             sub init {
9 2     2 0 51 my ($self, $app) = @_;
10             # Does not support Mojolicious Lite.
11 2 100       31 return if $app->isa('Mojolicious::Lite');
12 1         10 my $app_path = $app->home;
13 1         7 while (my($name, $mod) = each %{ $app->module->modules }) {
  2         3889  
14 1         21 my $path = $mod->config->{path};
15 1 50 33     46 dircopy("$path/assets", "$app_path/public/assets") or
16             croak("Can't copy $path/assets to $app_path/public") if -d "$path/assets";
17             }
18             }
19              
20             1;
21              
22             __END__