blib/lib/Statocles/Command/build.pm

filter: Statementstmt 81.2% 13 / 16 Branchbran 0.0% 0 / 2 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 2 / 2 Podpod 0.0% 0 / 1 totaltotal 65.3% 17 / 26 CC 5 SCAR 16.9
CC
5
Cov
71%
run
6.3
BEGIN
1.0
CRAP 5.4
« blib/lib/Statocles/Command/bundle.pm ↑ Summary blib/lib/Statocles/Template.pm »
1 package Statocles::Command::build;
2 5 our $VERSION = '0.099';
3 # ABSTRACT: Build the site in a directory
4  
5 5 ▶use Statocles::Base 'Command';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 9 ▶sub run {
Subroutine run: called CC=5 SCAR=18.4
Pod undocumented
8 9 my ( $self, @argv ) = @_;
9 9 my %build_opt;
10 9 GetOptionsFromArray( \@argv, \%build_opt,
11 'date|d=s',
12 'base_url|base=s',
13 );
14  
15 9 ▶ my $path = Path::Tiny->new( $argv[0] // $self->site->store->path->child( '.statocles', 'build' ) );
Condition66%2/3
$argv[0] // $self->site->store->path->child(".statocles", "build")
l!l&&r!l&&!r
270
MC/DC0%0/2
$argv[0] // $self->site->store->path->child(".statocles", "build")
$argv[0] $self->site->store->path->child(".statocles", "build")
Truth table66%2/3
A // B
A= $argv[0]B= $self->site->store->path->child(".statocles", "build")
ABresult
1X1
011
000
16 9 $path->mkpath;
17  
18 9 my $store = StoreType->coercion->( $path );
19 #; say "Building site at " . $store->path;
20  
21 # Remove all pages from the build directory first
22 9 $_->remove_tree for $store->path->children;
23  
24 9 my @pages = $self->site->pages( %build_opt );
25 0 for my $page ( @pages ) {
26 0 ▶ $store->write_file( $page->path, $page->has_dom ? $page->dom : $page->render );
Branch: 1 branch
BranchTrueFalseTotal
$page->has_dom ? : 0 0 0
27 }
28  
29 0 return 0;
30 }
31  
32 5 1;
33  
34 __END__
« blib/lib/Statocles/Command/bundle.pm ↑ Summary blib/lib/Statocles/Template.pm »