| 1 | package Rapi::Blog; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # ABSTRACT: RapidApp-powered blog | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use RapidApp 1.3301; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | extends 'RapidApp::Builder'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use Types::Standard qw(:all); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use RapidApp::Util ':all'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use File::ShareDir qw(dist_dir); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use FindBin; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | require Module::Locate; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use Path::Class qw/file dir/; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use YAML::XS 0.64 'LoadFile'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use HTML::Scrubber; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | ▶ | use Rapi::Blog::Scaffold; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | ▶ | use Rapi::Blog::Scaffold::Set; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | our $VERSION = '1.1400'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 1 | our $TITLE = "Rapi::Blog v" . $VERSION; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 1 | has 'site_path', is => 'ro', required => 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | has 'scaffold_path', is => 'ro', isa => Maybe[Str], default => sub { undef }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | has 'builtin_scaffold', is => 'ro', isa => Maybe[Str], default => sub { undef }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | has 'scaffold_config', is => 'ro', isa => HashRef, default => sub {{}}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | has 'fallback_builtin_scaffold', is => 'ro', isa => Bool, default => sub {0}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | has 'enable_password_reset', is => 'ro', isa => Bool, default => sub {1}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | has 'enable_user_sign_up', is => 'ro', isa => Bool, default => sub {1}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | has 'enable_email_login', is => 'ro', isa => Bool, default => sub {1}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | has 'underlay_scaffolds', is => 'ro', isa => ArrayRef[Str], default => sub {[]}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | has 'smtp_config', is => 'ro', isa => Maybe[HashRef], default => sub { undef }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | has 'override_email_recipient', is => 'ro', isa => Maybe[Str], default => sub { undef }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | has 'recaptcha_config', is => 'ro', isa => Maybe[HashRef[Str]], default => sub { undef }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | # constructor argument for HTML::Scrubber | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | has 'input_scrubber_cfg', is => 'ro', default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | my @exclude_tags = qw(script link style object embed iframe); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | my @limit_attrs = qw(style alt src href title class); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | rules => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | # ALLOW ALL TAGS: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | '*' => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | # EXCEPT ONES IN @exclude_tags: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | (map { $_ => 0 } @exclude_tags) | |||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | default => [ undef, { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | # DENY ALL ATTRIBUTES: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | '*' => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | # EXCEPT ONES IN @limit_attrs: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | (map { $_ => 1 } @limit_attrs) | |||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | }] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 1 | }, isa => HashRef; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | has '+base_appname', default => sub { 'Rapi::Blog::App' }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | has '+debug', default => sub {1}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | sub BUILD { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILD: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | print STDERR join('',' -- ',(blessed $self),' v',$self->VERSION,' -- ',"\n") if ($self->debug); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | has 'share_dir', is => 'ro', isa => Str, lazy => 1, default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | $self->_get_share_dir; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | sub _get_share_dir { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_share_dir: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | my $self = shift || __PACKAGE__; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || __PACKAGE__
MC/DC0%0/1
shift() || __PACKAGE__
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | $ENV{RAPI_BLOG_SHARE_DIR} || ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | try{dist_dir('Rapi-Blog')} || ( | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | -d "$FindBin::Bin/share" ? "$FindBin::Bin/share" : | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/6
$ENV{'RAPI_BLOG_SHARE_DIR'} || (&try(sub {
dist_dir('Rapi-Blog');
}
) || (-d "$FindBin::Bin/share" ? "$FindBin::Bin/share" : (-d "$FindBin::Bin/../share" ? "$FindBin::Bin/../share" : join('', $self->_module_locate_dir, '/../../share'))))
&try(sub {
dist_dir("Rapi-Blog");
}
) or -d "$FindBin::Bin/share" ? "$FindBin::Bin/share" : (-d "$FindBin::Bin/../share" ? "$FindBin::Bin/../share" : join("", $self->_module_locate_dir, "/../../share"))
MC/DC0%0/3
$ENV{'RAPI_BLOG_SHARE_DIR'} || (&try(sub {
dist_dir('Rapi-Blog');
}
) || (-d "$FindBin::Bin/share" ? "$FindBin::Bin/share" : (-d "$FindBin::Bin/../share" ? "$FindBin::Bin/../share" : join('', $self->_module_locate_dir, '/../../share'))))
$ENV{'RAPI_BLOG_SHARE_DIR'}
&try(sub {
dist_dir("Rapi-Blog");
}
)
-d "$FindBin::Bin/share" ? "$FindBin::Bin/share" : (-d "$FindBin::Bin/../share" ? "$FindBin::Bin/../share" : join("", $self->_module_locate_dir, "/../../share"))
Truth table0%0/4
A || B or C
A= $ENV{'RAPI_BLOG_SHARE_DIR'}B= &try(sub {
dist_dir("Rapi-Blog");
}
)C= -d "$FindBin::Bin/share" ? "$FindBin::Bin/share" : (-d "$FindBin::Bin/../share" ? "$FindBin::Bin/../share" : join("", $self->_module_locate_dir, "/../../share"))
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | -d "$FindBin::Bin/../share" ? "$FindBin::Bin/../share" : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | join('',$self->_module_locate_dir,'/../../share') | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | sub _module_locate_dir { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_module_locate_dir: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | my $pm_path = Module::Locate::locate('Rapi::Blog') or die "Failed to locate Rapi::Blog?!"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | file($pm_path)->parent->stringify | |||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | has '+inject_components', default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | my $model = 'Rapi::Blog::Model::DB'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | my $db = $self->site_dir->file('rapi_blog.db'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | Module::Runtime::require_module($model); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | $model->config->{connect_info}{dsn} = "dbi:SQLite:$db"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | return [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | [ $model => 'Model::DB' ], | |||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | [ 'Rapi::Blog::Model::Mailer' => 'Model::Mailer' ], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | [ 'Rapi::Blog::Controller::Remote' => 'Controller::Remote' ], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | [ 'Rapi::Blog::Controller::Remote::PreauthAction' => 'Controller::Remote::PreauthAction' ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | has 'input_Scrubber', is => 'ro', lazy => 1, default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | my $cfg = $self->input_scrubber_cfg or die "Failed to load input_scrubber_cfg"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | HTML::Scrubber->new( %$cfg ) | |||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 1 | }, isa => InstanceOf['HTML::Scrubber']; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | has 'site_dir', is => 'ro', init_arg => undef, lazy => 1, default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | my $Dir = dir( $self->site_path )->absolute; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | -d $Dir or die "Scaffold directory '$Dir' not found.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | return $Dir | |||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 1 | }, isa => InstanceOf['Path::Class::Dir']; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | has 'scaffolds', is => 'ro', lazy => 1, default => sub { undef }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | has 'ScaffoldSet', is => 'ro', init_arg => undef, lazy => 1, default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | my $scafs = $self->scaffolds || []; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->scaffolds || []
MC/DC0%0/1
$self->scaffolds || []
$self->scaffolds
Truth table0%0/2
A
A= $self->scaffolds
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | $scafs = [ $scafs ] unless (ref($scafs)||'' eq 'ARRAY'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
ref $scafs or
MC/DC0%0/1
ref $scafs or
ref $scafs
Truth table0%0/2
A
A= ref $scafs
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | $scafs = [ $self->scaffold_dir ] unless (scalar(@$scafs) > 0); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | my @list = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | Rapi::Blog::Scaffold->factory( $_ ) | |||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | } @$scafs, @{ $self->_get_underlay_scaffold_dirs }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | my $Set = Rapi::Blog::Scaffold::Set->new( Scaffolds => \@list ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | # Apply any custom configs to the *first* scaffold: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | $self->scaffold_config and $Set->first->config->_apply_params( $self->scaffold_config ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $Set | |||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 1 | }, isa => InstanceOf['Rapi::Blog::Scaffold::Set']; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | # This exists to be able to provide access to the running Blog config, including within | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | # templates, without the risk associated with providing direct access to the Rapi::Blog | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | # instance outright: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | ▶ | has 'BlogCfg', is => 'ro', init_arg => undef, lazy => 1, default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | my @keys = grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | my $Attr = $self->meta->get_attribute($_); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | !($_ =~ /^_/) # ignore attrs with private names (i.e. start with "_") | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/8
!($_ =~ /^_/) && ($Attr->reader || '') eq $_ && $Attr->has_value($self)
not $_ =~ /^_/ and ($Attr->reader || "") eq $_
$Attr->reader || ''
MC/DC0%0/3
!($_ =~ /^_/) && ($Attr->reader || '') eq $_ && $Attr->has_value($self)
not $_ =~ /^_/
$Attr->reader
$Attr->has_value($self)
Truth table0%0/4
not(A) and B && C
A= not $_ =~ /^_/B= $Attr->readerC= $Attr->has_value($self)
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | && ($Attr->reader||'') eq $_ # only consider attributes with normal accessor names | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | && $Attr->has_value($self) # and already have a value | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } $self->meta->get_attribute_list; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | # If any normal methods are desired in the future, add them to keys here | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | my $cfg = { map { $_ => $self->$_ } @keys }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | $cfg | |||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 1 | }, isa => HashRef; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | # Single merged config object which considers, prioritizes and flattens the configs of all scaffolds | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | has 'scaffold_cfg', is => 'ro', init_arg => undef, lazy => 1, default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | my %merged = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | map { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | %{ $_->config->_all_as_hash } | |||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } reverse ($self->ScaffoldSet->all) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | Rapi::Blog::Scaffold::Config->new( %merged ) | |||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 1 | }, isa => InstanceOf['Rapi::Blog::Scaffold::Config']; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | has 'scaffold_dir', is => 'ro', init_arg => undef, lazy => 1, default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | my $path; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | if(my $scaffold_name = $self->builtin_scaffold) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | die join('', | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | " Error: don't use both 'builtin_scaffold' and 'scaffold_path' options" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | ) if ($self->scaffold_path); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | my $Dir = $self->_get_builtin_scaffold_dir($scaffold_name)->absolute; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | -d $Dir or die "builtin scaffold '$scaffold_name' not found\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | $path = $Dir->stringify; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | ▶ | $path = $self->scaffold_path || $self->site_dir->subdir('scaffold'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->scaffold_path || $self->site_dir->subdir('scaffold')
MC/DC0%0/2
$self->scaffold_path || $self->site_dir->subdir('scaffold')
$self->scaffold_path
$self->site_dir->subdir('scaffold')
Truth table0%0/3
A || B
A= $self->scaffold_pathB= $self->site_dir->subdir('scaffold')
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | my $Dir = dir( $path ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | if(! -d $Dir) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | if($self->fallback_builtin_scaffold) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | my $scaffold_name = 'bootstrap-blog'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | warn join('', | |||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | "\n ** WARNING: local scaffold directory not found;\n --> using builtin ", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | "scaffold '$scaffold_name' (fallback_builtin_scaffold is set to true)\n\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | $Dir = $self->_get_builtin_scaffold_dir($scaffold_name); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | ▶ | -d $Dir or die join('', | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | " Fatal error: fallback scaffold not found (this could indicate a ", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | "problem with your Rapi::Blog installation)\n\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | die "Scaffold directory '$Dir' not found.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | return $Dir | |||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 1 | }, isa => InstanceOf['Path::Class::Dir']; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | sub _get_builtin_scaffold_dir { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_builtin_scaffold_dir: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | my ($self, $scaffold_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | ▶ | $scaffold_name ||= 'bootstrap-blog'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$scaffold_name ||= "bootstrap-blog"
MC/DC0%0/1
$scaffold_name ||= "bootstrap-blog"
$scaffold_name
Truth table0%0/2
A
A= $scaffold_name
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | my $Scaffolds = dir( $self->share_dir )->subdir('scaffolds')->absolute; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | ▶ | -d $Scaffolds or die join('', | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | " Fatal error: Unable to locate scaffold share dir (this could indicate a ", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | "problem with your Rapi::Blog installation)\n\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | $Scaffolds->subdir($scaffold_name) | |||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | after 'bootstrap' => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | my $c = $self->appname; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | $c->setup_plugins(['+Rapi::Blog::CatalystApp']); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | ▶ | sub _get_underlay_scaffold_dirs { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_underlay_scaffold_dirs: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | my $CommonUnderlay = dir( $self->share_dir )->subdir('common_underlay')->absolute; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | -d $CommonUnderlay or die join('', | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | " Fatal error: Unable to locate common underlay scaffold dir (this could ", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | "indicate a problem with your Rapi::Blog installation)\n\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | return [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | @{$self->underlay_scaffolds}, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | $CommonUnderlay | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | sub _enforce_valid_recaptcha_config { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_enforce_valid_recaptcha_config: not called CC=10 SCAR=47.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | my $cfg = $self->recaptcha_config or return 1; # No config at all is valid | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | my @valid_keys = qw/public_key private_key verify_url strict_mode/; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | my %keys = map {$_=>1} @valid_keys; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | for my $k (keys %$cfg) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | $keys{$k} or die join('', | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | "Unknown recaptcha_config param '$k' - ", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | "only valid params are: ",join(', ',@valid_keys) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | die "Invalid recaptcha_config - both 'public_key' and 'private_key' params are required" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | unless ($cfg->{public_key} && $cfg->{private_key}); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$cfg->{"public_key"} and $cfg->{"private_key"}
MC/DC0%0/2
$cfg->{"public_key"} and $cfg->{"private_key"}
$cfg->{"public_key"}
$cfg->{"private_key"}
Truth table0%0/3
A and B
A= $cfg->{"public_key"}B= $cfg->{"private_key"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | if(exists $cfg->{strict_mode}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | my $v = $cfg->{strict_mode}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | ▶ | my $disp = defined $v ? "'$v'" : 'undef'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | ▶ | die "Bad value $disp for 'strict_mode' in recaptcha_config - must be either 1 (true) or 0 (false)\n" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"$v" eq 0 or "$v" eq 1
MC/DC0%0/2
"$v" eq 0 or "$v" eq 1
"$v" eq 0
"$v" eq 1
Truth table0%0/3
A or B
A= "$v" eq 0B= "$v" eq 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | unless ("$v" eq '0' || "$v" eq '1') | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | ▶ | sub _build_version { $VERSION } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_version: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | sub _build_plugins { [qw/ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_plugins: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | RapidApp::RapidDbic | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | RapidApp::AuthCore | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | RapidApp::NavCore | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | RapidApp::CoreSchemaAdmin | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | /]} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | ▶ | sub _build_base_config { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_base_config: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | $self->_enforce_valid_recaptcha_config; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | my $tpl_dir = join('/',$self->share_dir,'templates'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | ▶ | -d $tpl_dir or die join('', | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | "template dir ($tpl_dir) not found; ", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | __PACKAGE__, " may not be installed properly.\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | my $loc_assets_dir = join('/',$self->share_dir,'assets'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | ▶ | -d $loc_assets_dir or die join('', | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | "assets dir ($loc_assets_dir) not found; ", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | __PACKAGE__, " may not be installed properly.\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | my $config = { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 'RapidApp' => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | module_root_namespace => 'adm', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | local_assets_dir => $loc_assets_dir, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | load_modules => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | sections => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | class => 'Rapi::Blog::Module::SectionTree', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | params => {} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 'Plugin::RapidApp::NavCore' => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | navtree_class => 'Rapi::Blog::Module::NavTree', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 'Model::RapidApp::CoreSchema' => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | sqlite_file => $self->site_dir->file('rapidapp_coreschema.db')->stringify | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 'Plugin::RapidApp::AuthCore' => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | linked_user_model => 'DB::User' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 'Controller::SimpleCAS' => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | store_path => $self->site_dir->subdir('cas_store')->stringify | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 'Plugin::RapidApp::TabGui' => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | title => $TITLE, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | nav_title => 'Administration', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | banner_template => file($tpl_dir,'banner.html')->stringify, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | dashboard_url => '/tpl/dashboard.md', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | navtree_init_width => 190, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 'Controller::RapidApp::Template' => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | root_template_prefix => '/', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | root_template => $self->scaffold_cfg->landing_page, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | read_alias_path => '/tpl', #<-- already the default | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | edit_alias_path => '/tple', #<-- already the default | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | default_template_extension => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | include_paths => [ $tpl_dir ], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | access_class => 'Rapi::Blog::Template::AccessStore', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | access_params => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | BlogCfg => $self->BlogCfg, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | ScaffoldSet => $self->ScaffoldSet, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | scaffold_cfg => $self->scaffold_cfg, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | #internal_post_path => $self->scaffold_cfg->internal_post_path, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | #default_view_path => $self->scaffold_cfg->default_view_path, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | #scaffold_dir => $self->scaffold_dir, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | #scaffold_cnf => $self->scaffold_cnf, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | #static_paths => $self->scaffold_cnf->{static_paths}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | #private_paths => $self->scaffold_cnf->{private_paths}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | #default_ext => $self->scaffold_cnf->{default_ext}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | #internal_post_path => $self->scaffold_cnf->{internal_post_path}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | #view_wrappers => $self->scaffold_cnf->{view_wrappers}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | #default_view_path => $self->default_view_path, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | #preview_path => $self->preview_path, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | #underlay_scaffold_dirs => $self->_get_underlay_scaffold_dirs, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | ▶ | get_Model => sub { $self->base_appname->model('DB') } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | ▶ | 'Model::Mailer' => { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | smtp_config => $self->smtp_config, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | ( $self->override_email_recipient ? (envelope_to => $self->override_email_recipient) : () ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | ▶ | if(my $faviconPath = $self->ScaffoldSet->first_config_value_filepath('favicon')) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | $config->{RapidApp}{default_favicon_url} = $faviconPath; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | ▶ | if(my $loginTpl = $self->ScaffoldSet->first_config_value_file('login')) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | $config->{'Plugin::RapidApp::AuthCore'}{login_template} = $loginTpl; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | ▶ | if(my $errorTpl = $self->ScaffoldSet->first_config_value_file('error')) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | $config->{'RapidApp'}{error_template} = $errorTpl; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | return $config | |||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||