| 1 | package Zucchini; | ||||||||||||||||||||||||||||
| 2 | 5 | $Zucchini::VERSION = '0.0.21'; | |||||||||||||||||||||||||||
| 3 | { | ||||||||||||||||||||||||||||
| 4 | 5 | $Zucchini::DIST = 'Zucchini'; | |||||||||||||||||||||||||||
| 5 | } | ||||||||||||||||||||||||||||
| 6 | # ABSTRACT: turn templates into static websites | ||||||||||||||||||||||||||||
| 7 | # vim: ts=8 sts=4 et sw=4 sr sta | ||||||||||||||||||||||||||||
| 8 | 5 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 5 | ▶ | use strict; # for kwalitee testing | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 5 | ▶ | use Zucchini::Types qw(:all); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 5 | ▶ | use Zucchini::Config; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 5 | ▶ | use Zucchini::Fsync; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 5 | ▶ | use Zucchini::Rsync; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 5 | ▶ | use Zucchini::Template; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 5 | has config => ( | |||||||||||||||||||||||||||
| 18 | reader => 'get_config', | ||||||||||||||||||||||||||||
| 19 | writer => 'set_config', | ||||||||||||||||||||||||||||
| 20 | isa => ZucchiniConfig, | ||||||||||||||||||||||||||||
| 21 | is => 'ro', | ||||||||||||||||||||||||||||
| 22 | ); | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 3 | ▶ | sub BUILD { | ||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 25 | 3 | my ($self, $arg_ref) = @_; | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | # set our config to be a new Zucchini::Config object | ||||||||||||||||||||||||||||
| 28 | # instantiated with the arguments passed to ourself | ||||||||||||||||||||||||||||
| 29 | 3 | $self->set_config( | |||||||||||||||||||||||||||
| 30 | Zucchini::Config->new( | ||||||||||||||||||||||||||||
| 31 | $arg_ref | ||||||||||||||||||||||||||||
| 32 | ) | ||||||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 3 | return; | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 0 | ▶ | sub gogogo { | ||||||||||||||||||||||||||
|
Subroutine
gogogo: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||
| 39 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | # if we're not rsync-only or fsync-only, we should perform the | ||||||||||||||||||||||||||||
| 42 | # template processing | ||||||||||||||||||||||||||||
| 43 | 0 | ▶ | if ( | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->get_config->is_rsync_only || $self->get_config->is_fsync_only
MC/DC0%0/2
$self->get_config->is_rsync_only || $self->get_config->is_fsync_only
$self->get_config->is_rsync_only
$self->get_config->is_fsync_only
Truth table0%0/3
A || B
A= $self->get_config->is_rsync_onlyB= $self->get_config->is_fsync_only
| |||||||||||||||||||||||||||||
| 44 | not ( | ||||||||||||||||||||||||||||
| 45 | $self->get_config->is_rsync_only() | ||||||||||||||||||||||||||||
| 46 | or | ||||||||||||||||||||||||||||
| 47 | $self->get_config->is_fsync_only() | ||||||||||||||||||||||||||||
| 48 | ) | ||||||||||||||||||||||||||||
| 49 | ) { | ||||||||||||||||||||||||||||
| 50 | 0 | $self->process_templates; | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | # let verbose people know we're *NOT* processing any templates | ||||||||||||||||||||||||||||
| 53 | else { | ||||||||||||||||||||||||||||
| 54 | 0 | ▶ | if ($self->get_config->verbose) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | 0 | warn "Skipping template processing phase\n"; | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | # was a remote-sync requested? | ||||||||||||||||||||||||||||
| 61 | 0 | ▶ | if ( | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->get_config->is_rsync or $self->get_config->is_rsync_only
MC/DC0%0/2
$self->get_config->is_rsync or $self->get_config->is_rsync_only
$self->get_config->is_rsync
$self->get_config->is_rsync_only
Truth table0%0/3
A or B
A= $self->get_config->is_rsyncB= $self->get_config->is_rsync_only
| |||||||||||||||||||||||||||||
| 62 | $self->get_config->is_rsync() | ||||||||||||||||||||||||||||
| 63 | or | ||||||||||||||||||||||||||||
| 64 | $self->get_config->is_rsync_only() | ||||||||||||||||||||||||||||
| 65 | ) { | ||||||||||||||||||||||||||||
| 66 | 0 | $self->remote_sync; | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | # was an ftp-sync requested? | ||||||||||||||||||||||||||||
| 70 | 0 | ▶ | if ( | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->get_config->is_fsync or $self->get_config->is_fsync_only
MC/DC0%0/2
$self->get_config->is_fsync or $self->get_config->is_fsync_only
$self->get_config->is_fsync
$self->get_config->is_fsync_only
Truth table0%0/3
A or B
A= $self->get_config->is_fsyncB= $self->get_config->is_fsync_only
| |||||||||||||||||||||||||||||
| 71 | $self->get_config->is_fsync() | ||||||||||||||||||||||||||||
| 72 | or | ||||||||||||||||||||||||||||
| 73 | $self->get_config->is_fsync_only() | ||||||||||||||||||||||||||||
| 74 | ) { | ||||||||||||||||||||||||||||
| 75 | 0 | $self->ftp_sync; | |||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 3 | ▶ | sub process_templates { | ||||||||||||||||||||||||||
|
Subroutine
process_templates: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 80 | 3 | my $self = shift; | |||||||||||||||||||||||||||
| 81 | 3 | my ($templater); | |||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | # create a new templater object | ||||||||||||||||||||||||||||
| 84 | 3 | $templater = Zucchini::Template->new( | |||||||||||||||||||||||||||
| 85 | { | ||||||||||||||||||||||||||||
| 86 | config => $self->get_config, | ||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||
| 88 | ); | ||||||||||||||||||||||||||||
| 89 | # process the site | ||||||||||||||||||||||||||||
| 90 | 3 | $templater->process_site; | |||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 3 | return; | |||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 0 | ▶ | sub ftp_sync { | ||||||||||||||||||||||||||
|
Subroutine
ftp_sync: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 96 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 97 | 0 | my ($fsyncer); | |||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | # create a new fsync object | ||||||||||||||||||||||||||||
| 100 | 0 | $fsyncer = Zucchini::Fsync->new( | |||||||||||||||||||||||||||
| 101 | { | ||||||||||||||||||||||||||||
| 102 | config => $self->get_config, | ||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | ); | ||||||||||||||||||||||||||||
| 105 | # transfer the site | ||||||||||||||||||||||||||||
| 106 | 0 | $fsyncer->ftp_sync; | |||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 0 | return; | |||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 0 | ▶ | sub remote_sync { | ||||||||||||||||||||||||||
|
Subroutine
remote_sync: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 112 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 113 | 0 | my ($rsyncer); | |||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | # create a new rsync object | ||||||||||||||||||||||||||||
| 116 | 0 | $rsyncer = Zucchini::Rsync->new( | |||||||||||||||||||||||||||
| 117 | { | ||||||||||||||||||||||||||||
| 118 | config => $self->get_config, | ||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||
| 120 | ); | ||||||||||||||||||||||||||||
| 121 | # transfer the site | ||||||||||||||||||||||||||||
| 122 | 0 | $rsyncer->remote_sync; | |||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 0 | return; | |||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | # true value at tail end of module' | ||||||||||||||||||||||||||||
| 128 | 5 | q{This truth was inspired by YAPC::Europe::2008}; | |||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | __END__ | ||||||||||||||||||||||||||||