« lib/Mojolicious/Plugin/Fondation.pm
↑ Summary
blib/lib/Mojolicious/Plugin/Fondation/Controller/Base.pm »
| 1 | package Mojolicious::Plugin::Fondation::Action::Static; | ||||||||||||||||||||||||||||
| 2 | 15 | $Mojolicious::Plugin::Fondation::Action::Static::VERSION = '0.08'; | |||||||||||||||||||||||||||
| 3 | # ABSTRACT: Registers public asset directories from plugin share directories | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 15 | ▶ | use Mojo::Base 'Mojolicious::Plugin::Fondation::Action::Base', -signatures; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 15 | ▶ | use Mojolicious::Plugin::Fondation::Utils qw(share_relative); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 156 | ▶ | sub after_load ($self, $long, $conf, $share_dir) { | ||||||||||||||||||||||||||
|
Subroutine
after_load: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 10 | 156 | ▶ | return unless $share_dir && -d $share_dir; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$share_dir and -d $share_dir
MC/DC50%1/2
$share_dir and -d $share_dir
$share_dir
-d $share_dir
Truth table66%2/3
A and B
A= $share_dirB= -d $share_dir
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 135 | my $public_dir = $share_dir->child('public'); | |||||||||||||||||||||||||||
| 13 | 135 | ▶ | return unless -d $public_dir; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 84 | my $manager = $self->manager; | |||||||||||||||||||||||||||
| 16 | 84 | my $app = $manager->app; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | # Add public directory to static file paths | ||||||||||||||||||||||||||||
| 19 | 84 | push @{$app->static->paths}, $public_dir->to_string; | |||||||||||||||||||||||||||
| 20 | 84 | $self->log->debug("Added public path: " . share_relative($public_dir)); | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | # Store in registry for other consumers (e.g. Asset plugin) | ||||||||||||||||||||||||||||
| 23 | 84 | my $entry = $manager->registry->{$long}; | |||||||||||||||||||||||||||
| 24 | 84 | $entry->{public_dir} = $public_dir; | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 15 | 1; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | __END__ | ||||||||||||||||||||||||||||