File Coverage

lib/Mojolicious/Plugin/Module/Assets.pm
Criterion Covered Total %
statement 7 9 77.7
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 10 12 83.3


line stmt bran cond sub pod time code
1             package Mojolicious::Plugin::Module::Assets;
2 3     3   16 use Mojo::Base -base;
  3         4  
  3         21  
3 3     3   636 use Mojo::Util qw/decamelize/;
  3         5  
  3         172  
4 3     3   1385 use File::Copy::Recursive qw/dircopy/;
  0            
  0            
5             use FindBin;
6             use Carp;
7              
8             sub init {
9             my ($self, $app) = @_;
10             # Does not support Mojolicious Lite.
11             return if $app->isa('Mojolicious::Lite');
12             my $app_path = $app->home;
13             while (my($name, $mod) = each %{ $app->module->modules }) {
14             my $path = $mod->config->{path};
15             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__