blib/lib/Yukki/Web/Settings.pm

filter: Statementstmt 76.7% 33 / 43 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 46.6% 7 / 15 Podpod 100% 2 / 2 totaltotal 70.0% 42 / 60 SCAR 0.1
CC
1
Cov
77%
__ANON__
2.0
all_scripts
2.0
__ANON__
2.0
CRAP 1.0
« blib/lib/Yukki/Web/Router.pm ↑ Summary blib/lib/Yukki/User.pm »
1 package Yukki::Web::Settings;
2 4 $Yukki::Web::Settings::VERSION = '0.991_002'; # TRIAL
3  
4 4 ▶$Yukki::Web::Settings::VERSION = '0.991002';use v5.24;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 4 extends 'Yukki::Settings';
9  
10 4 ▶use Types::Path::Tiny qw( Path );
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use Types::Standard qw( ArrayRef HashRef Str );
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶use Yukki::Types qw( BaseURL PluginConfig );
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 4 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 # ABSTRACT: provides structure and validation to web settings in yukki.conf
17  
18  
19 4 has template_path => (
20 is => 'ro',
21 isa => Path,
22 required => 1,
23 coerce => 1,
24 default => 'root/template',
25 );
26  
27  
28 4 has static_path => (
29 is => 'ro',
30 isa => Path,
31 required => 1,
32 coerce => 1,
33 default => 'root',
34 );
35  
36  
37 4 has base_url => (
38 is => 'ro',
39 isa => BaseURL,
40 required => 1,
41 coerce => 1,
42 default => 'SCRIPT_NAME',
43 );
44  
45  
46 has scripts => (
47 is => 'ro',
48 isa => ArrayRef[Str],
49 required => 1,
50 default => sub {
51 0 ▶ [ qw(
Subroutine __ANON__: not called CC=1 SCAR=6.9
52 script/lib/jquery/jquery.js
53 script/lib/jquery/jquery-ui.js
54 script/lib/jquery/jquery.caret.js
55 script/lib/jquery/jquery.tag-editor.js
56 script/lib/plupload/plupload.full.js
57 script/lib/sha1/sha1.js
58 script/yukki.js
59 ) ]
60 },
61 4 );
62  
63 sub all_scripts {
64 0 ▶ my $self = shift;
Subroutine all_scripts: not called CC=1 SCAR=6.9
Pod documented
65 0 $self->scripts->@*;
66 }
67  
68 has styles => (
69 is => 'ro',
70 isa => ArrayRef[Str],
71 required => 1,
72 default => sub {
73 0 ▶ [ qw(
Subroutine __ANON__: not called CC=1 SCAR=6.9
74 style/yukki.css
75 style/lib/jquery/jquery.css
76 style/lib/jquery/jquery.tag-editor.css
77 ) ]
78 },
79 4 );
80  
81 sub all_styles {
82 0 ▶ my $self = shift;
Subroutine all_styles: not called CC=1 SCAR=6.9
Pod documented
83 0 $self->styles->@*;
84 }
85  
86  
87 has menu_names => (
88 is => 'ro',
89 isa => ArrayRef[Str],
90 required => 1,
91 0 ▶ default => sub { [ qw(
Subroutine __ANON__: not called CC=1 SCAR=6.9
92 repository
93 user
94 page
95 page_bottom
96 ) ] },
97 4 );
98  
99  
100 has page_views => (
101 is => 'ro',
102 isa => HashRef[HashRef],
103 required => 1,
104 default => sub { +{
105 0 ▶ default => {
Subroutine __ANON__: not called CC=1 SCAR=6.9
106 label => 'View',
107 sort => 10,
108 template => 'shell.html',
109 },
110 slides => {
111 label => 'Slides',
112 sort => 11,
113 template => 'slides.html',
114 hide => 1,
115 vars => {
116 "head link.local" => [ qw( style/slides.css ) ],
117 "head script.local" => [ qw( script/slides.js ) ],
118 },
119 },
120 } },
121 4 );
122  
123  
124 has plugins => (
125 is => 'ro',
126 isa => PluginConfig,
127 required => 1,
128 default => sub { [
129 0 ▶ { module => 'Attachment' },
Subroutine __ANON__: not called CC=1 SCAR=6.9
130 { module => 'YukkiText' },
131 ] },
132 4 );
133  
134  
135 has media_types => (
136 is => 'ro',
137 isa => HashRef[Str|ArrayRef[Str]],
138 required => 1,
139 default => sub { +{
140 0 ▶ 'text/yukki' => 'yukki',
Subroutine __ANON__: not called CC=1 SCAR=6.9
141 } },
142 4 );
143  
144  
145 4 1;
146  
147 __END__
148  
149 =pod
150  
151 =encoding UTF-8
152  
153 =head1 NAME
154  
155 Yukki::Web::Settings - provides structure and validation to web settings in yukki.conf
156  
157 =head1 VERSION
158  
159 version 0.991_002
160  
161 =head1 DESCRIPTION
162  
163 L<Yukki::Web> needs a few additional settings.
164  
165 =head1 ATTRIBUTES
166  
167 =head2 template_path
168  
169 THis is the folder where Yukki will find templates under the C<root>. The default is F<root/template>.
170  
171 =head2 static_path
172  
173 This is the folder where Yukki will find the static files to serve for your application.
174  
175 =head2 base_url
176  
177 This configures the L<Yukki::Web::Context/base_url> attribute. It is either an absolute URL or the words C<SCRIPT_NAME> or C<REWRITE>. See L<Yukki::Web::Context/base_url> for more information.
178  
179 The default is C<SCRIPT_NAME>.
180  
181 =head2 scripts
182  
183 =head2 styles
184  
185 This is a list of the JavaScript and CSS files, respectively, to load into the
186 shell template. If not set, the defaults are:
187  
188 scripts:
189 - script/lib/jquery/jquery.js
190 - script/lib/jquery/jquery-ui.js
191 - script/lib/jquery/jquery.caret.js
192 - script/lib/jquery/jquery.tag-editor.js
193 - script/lib/plupload/plupload.full.js
194 - script/lib/sha1/sha1.js
195 - script/yukki.js
196  
197 styles:
198 - style/yukki.css
199 - style/lib/jquery/jquery.css
200 - style/lib/jquery/jquery.tag-editor.css
201  
202 As you can see, these are full paths and may be given as paths to foreign hosts.
203 In order to keep Yukki working in good order, you will probaby want to include
204 at least the scripts listed above.
205  
206 =head2 menu_names
207  
208 In case your templates have custom menus on them, you may need to set this. The default is:
209  
210 menu_names:
211 - repository
212 - user
213 - page
214 - page_bottom
215  
216 This will insure that those menus are empty when they should be empty.
217  
218 =head2 page_views
219  
220 This is the list of page views to provide. By default, this is
221  
222 page_views:
223 default:
224 label: View
225 sort: 10
226 template: shell.html
227 slides:
228 label: Slides
229 sort: 11
230 template: slides.html
231 hide: 1
232 vars:
233 "head link.local":
234 - style/slides.css
235 "head script.local":
236 - script/slides.js
237  
238 =head2 plugins
239  
240 This is the list of plugins to use. This is an array of hashes. The hashes must have a C<module> key naming the class defining the plugin. The rest of the keys will be passed to the plugin constructor.
241  
242 =head2 media_types
243  
244 This is a list of custom media types. Because media types are detected using L<LWP::MediaTypes>, you may also configured media types by putting a F<.media.types> file in the home directory of the user running Yukki.
245  
246 By default, "text/yukki" is mapped to the "yukki" file extension.
247  
248 =head1 METHODS
249  
250 =head2 all_scripts
251  
252 Convenience accessor that returns C<scripts> as a list.
253  
254 =head2 all_styles
255  
256 Convenience accessor that returns C<styles> as a list.
257  
258 =head1 AUTHOR
259  
260 Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
261  
262 =head1 COPYRIGHT AND LICENSE
263  
264 This software is copyright (c) 2017 by Qubling Software LLC.
265  
266 This is free software; you can redistribute it and/or modify it under
267 the same terms as the Perl 5 programming language system itself.
268  
269 =cut
« blib/lib/Yukki/Web/Router.pm ↑ Summary blib/lib/Yukki/User.pm »