File Coverage

blib/lib/Yukki/Settings.pm
Criterion Covered Total %
statement 38 38 100.0
branch n/a
condition n/a
subroutine 13 13 100.0
pod n/a
total 51 51 100.0


line stmt bran cond sub pod time code
1             package Yukki::Settings;
2             $Yukki::Settings::VERSION = '0.991_001'; # TRIAL
3              
4 3     3   44 $Yukki::Settings::VERSION = '0.991001';use v5.24;
  3         13  
5 3     3   24 use utf8;
  3         8  
  3         32  
6 3     3   97 use Moo;
  3         27  
  3         29  
7              
8 3     3   2758 use Types::Path::Tiny qw( Path );
  3         339755  
  3         52  
9 3     3   2374 use Types::Standard qw( Str );
  3         8  
  3         60  
10 3     3   4140 use Yukki::Types qw( RepositoryMap YukkiSettingsAnonymous );
  3         15  
  3         35  
11              
12 3     3   2395 use namespace::clean;
  3         10  
  3         32  
13              
14             # ABSTRACT: provides structure and validation to settings in yukki.conf
15              
16              
17             has root => (
18             is => 'ro',
19             isa => Path,
20             required => 1,
21             coerce => 1,
22             default => '.',
23             );
24              
25              
26             has repository_path => (
27             is => 'ro',
28             isa => Path,
29             required => 1,
30             coerce => 1,
31             default => 'repositories',
32             );
33              
34              
35             has user_path => (
36             is => 'ro',
37             isa => Path,
38             required => 1,
39             coerce => 1,
40             default => 'var/db/users',
41             );
42              
43              
44             has digest => (
45             is => 'ro',
46             isa => Str,
47             required => 1,
48             default => 'SHA-512',
49             );
50              
51              
52             has anonymous => (
53             is => 'ro',
54             isa => YukkiSettingsAnonymous,
55             required => 1,
56             coerce => 1,
57             default => sub { Yukki::Settings::Anonymous->new },
58             );
59              
60              
61             has repositories => (
62             is => 'ro',
63             isa => RepositoryMap,
64             required => 1,
65             coerce => 1,
66             );
67              
68             {
69             package Yukki::Settings::Anonymous;
70             $Yukki::Settings::Anonymous::VERSION = '0.991_001'; # TRIAL
71              
72 3     3   1413 $Yukki::Settings::Anonymous::VERSION = '0.991001';use Moo;
  3         7  
  3         23  
73 3     3   1138 use Types::Standard qw( Str );
  3         7  
  3         37  
74 3     3   2039 use Yukki::Types qw( EmailAddress );
  3         5  
  3         13  
75              
76             has author_name => (
77             is => 'ro',
78             isa => Str,
79             required => 1,
80             default => 'Anonymous',
81             );
82              
83             has author_email => (
84             is => 'ro',
85             isa => EmailAddress,
86             required => 1,
87             coerce => 1,
88             default => 'anonymous@localhost',
89             );
90             }
91              
92             {
93             package Yukki::Settings::Repository;
94             $Yukki::Settings::Repository::VERSION = '0.991_001'; # TRIAL
95              
96 3     3   1499 $Yukki::Settings::Repository::VERSION = '0.991001';use Moo;
  3         39  
  3         14  
97 3     3   794 use Types::Path::Tiny qw( Path );
  3         6  
  3         21  
98 3     3   941 use Types::Standard qw( ArrayRef Int Str );
  3         7  
  3         19  
99              
100             has repository => (
101             is => 'ro',
102             isa => Path,
103             required => 1,
104             coerce => 1,
105             );
106              
107             has site_branch => (
108             is => 'ro',
109             isa => Str,
110             required => 1,
111             default => 'refs/heads/master',
112             );
113              
114             has name => (
115             is => 'ro',
116             isa => Str,
117             required => 1,
118             );
119              
120             has default_page => (
121             is => 'ro',
122             isa => Path,
123             required => 1,
124             coerce => 1,
125             default => 'home.yukki',
126             );
127              
128             has sort => (
129             is => 'ro',
130             isa => Int,
131             required => 1,
132             default => 50,
133             );
134              
135             has anonymous_access_level => (
136             is => 'ro',
137             isa => Yukki::Types::AccessLevel,
138             required => 1,
139             default => 'none',
140             );
141              
142             has read_groups => (
143             is => 'ro',
144             isa => Str|ArrayRef[Str],
145             required => 1,
146             default => 'NONE',
147             );
148              
149             has write_groups => (
150             is => 'ro',
151             isa => Str|ArrayRef[Str],
152             required => 1,
153             default => 'NONE',
154             );
155             }
156              
157             1;
158              
159             __END__
160              
161             =pod
162              
163             =encoding UTF-8
164              
165             =head1 NAME
166              
167             Yukki::Settings - provides structure and validation to settings in yukki.conf
168              
169             =head1 VERSION
170              
171             version 0.991_001
172              
173             =head1 DESCRIPTION
174              
175             This class provides structure for the main application configuration in L<Yukki>.
176              
177             Yukki may fail to start unless your configuration is correct.
178              
179             =head1 ATTRIBUTES
180              
181             =head2 root
182              
183             This is the wiki site directory. This should be the same folder that was given the F<yukki-setup> command. It works best if you make this an absolute path.
184              
185             =head2 repository_path
186              
187             This is the folder where Yukki will find the git repositories installed under C<root>. The default is F<root/repositories>.
188              
189             =head2 user_path
190              
191             This is the folder where the list of user files can be found.
192              
193             =head2 digest
194              
195             This is the name of the digest algorithm to use to store passwords. See L<Digest> for more information. The default is "SHA-512".
196              
197             N.B. If you change digest algorithms, old passwords saved with the old digest algorithm will continue to work as long as the old digest algorithm class is still installed.
198              
199             =head2 anonymous
200              
201             This is a section configuring anonymous user information.
202              
203             =over
204              
205             =item author_name
206              
207             This is the name to use when an anonymous user makes a change to a wiki repository.
208              
209             =item author_email
210              
211             This is the email address to use when an anonymous user makes a change to a wiki repository.
212              
213             =back
214              
215             =head2 repositories
216              
217             This is a section under which each repository is configured. The keys under here are the name found in the URL. It is also the name to use when running the F<yukki-git-init> and other repository-related commands.
218              
219             Each repository configuraiton should provide the following configruation keys.
220              
221             =over
222              
223             =item repository
224              
225             This is required. This is the name of the git repository folder found under C<repository_path>.
226              
227             =item site_branch
228              
229             This is teh name of the branch that will contain the wiki's files. The default is C<refs/heads/master>. You could actually use the same git repository for multiple Yukki repositories by using different branches. If you want to do it that way for some reason. Unless you know what you're doing, you probably don't want to do that.
230              
231             =item name
232              
233             This is a human readable title for the repository.
234              
235             =item default_page
236              
237             This is the name of the main repository index.
238              
239             =item anonymous_access_level
240              
241             This should be set to one of the following: read, write, or none. This settings decides how much access an anonymous user has when visiting your wiki.
242              
243             =item read_groups
244              
245             This may be set to the word "ANY" or the word "NONE" or to an array of group names.
246              
247             If set to ANY, any logged user may read this repository. If set to NONE, read access is not granted to any logged user (though if C<anonymous_access_level> or C<write_groups> grant a user access, the user will be able to read the repository).
248              
249             If an array of one or more group names are given, the users with any of those groups will be able to read the repository.
250              
251             =item write_groups
252              
253             THe possible values that may be set are identicl to C<read_groups>. This setting determines who has permission to edit pages and upload files to the repository.
254              
255             =back
256              
257             =head1 AUTHOR
258              
259             Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
260              
261             =head1 COPYRIGHT AND LICENSE
262              
263             This software is copyright (c) 2017 by Qubling Software LLC.
264              
265             This is free software; you can redistribute it and/or modify it under
266             the same terms as the Perl 5 programming language system itself.
267              
268             =cut