| 1 | 1 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 2 | 1 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 3 | |||||||||||||||
| 4 | package App::Embra::Plugin::PublishFiles; | ||||||||||||||
| 5 | 1 | $App::Embra::Plugin::PublishFiles::VERSION = '0.001'; # TRIAL | |||||||||||||
| 6 | # ABSTRACT: write site files into a directory | ||||||||||||||
| 7 | |||||||||||||||
| 8 | 1 | ▶ | use Path::Class qw<>; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 9 | 1 | ▶ | use Method::Signatures; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 10 | 1 | ▶ | use Moo; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 11 | |||||||||||||||
| 12 | |||||||||||||||
| 13 | |||||||||||||||
| 14 | 1 | ▶ | has 'to' => ( | ||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.4
Branch: 2 branches
| |||||||||||||||
| 15 | 1 | is => 'ro', | |||||||||||||
| 16 | required => 1, | ||||||||||||||
| 17 | 1 | ▶ | default => '.', | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
publish_site: called CC=4 SCAR=14.0
Branch: 1 branch
| |||||||||||||||
| 18 | 1 | coerce => func( $path_as_str ) { Path::Class::dir( $path_as_str ) }, | |||||||||||||
| 19 | 2 | ); | |||||||||||||
| 20 | 2 | ||||||||||||||
| 21 | 2 | method publish_site { | |||||||||||||
| 22 | 2 | ▶ | for my $file ( @{ $self->embra->files } ) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 23 | my $f = $self->to->file( $file->name ); | ||||||||||||||
| 24 | $f->parent->mkpath; | ||||||||||||||
| 25 | $f->spew( $file->content ); | ||||||||||||||
| 26 | 1 | ▶ | chmod $file->mode, $f or die "could't chmod $file: $!"; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.1
Subroutine
exclude_file: called CC=4 SCAR=14.0
Branch: 2 branches
| |||||||||||||||
| 27 | 3 | ▶ | } | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 28 | 2 | } | |||||||||||||
| 29 | |||||||||||||||
| 30 | method exclude_file( $file ) { | ||||||||||||||
| 31 | 1 | return 1 if $self->to->subsumes( $file->name ); | |||||||||||||
| 32 | 1 | return; | |||||||||||||
| 33 | } | ||||||||||||||
| 34 | 1 | ||||||||||||||
| 35 | with 'App::Embra::Role::SitePublisher'; | ||||||||||||||
| 36 | with 'App::Embra::Role::FilePruner'; | ||||||||||||||
| 37 | |||||||||||||||
| 38 | 1; | ||||||||||||||
| 39 | |||||||||||||||
| 40 | __END__ | ||||||||||||||