| 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")
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")
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 27 | } | ||||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | 0 | return 0; | |||||||||||||||||||
| 30 | } | ||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | 5 | 1; | |||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | __END__ | ||||||||||||||||||||