File: | lib/Yukki/Settings/Repository.pm |
Coverage: | 93.3% |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Yukki::Settings::Repository; | ||||||
2 | |||||||
3 | 4 4 | 26 11 | use v5.24; | ||||
4 | 4 4 4 | 12 4 17 | use utf8; | ||||
5 | 4 4 4 | 45 6 13 | use Moo; | ||||
6 | |||||||
7 | extends 'Yukki::Settings::Privileges'; | ||||||
8 | |||||||
9 | with 'Yukki::Role::Savable'; | ||||||
10 | |||||||
11 | 4 4 4 | 825 7 15 | use Types::Path::Tiny qw( Path ); | ||||
12 | 4 4 4 | 893 5 13 | use Types::Standard qw( ArrayRef Int Str ); | ||||
13 | 4 4 4 | 2891 7 19 | use Yukki::Types qw( AccessLevel ); | ||||
14 | |||||||
15 | 4 4 4 | 1430 6 18 | use namespace::clean; | ||||
16 | |||||||
17 | # ABSTRACT: settings describing a wiki repository | ||||||
18 | |||||||
19 - 37 | =head1 DESCRIPTION This class provides structure for describing a git repository used to back a Yukki workspace. These may either be defined as part of the main settings file for command-line managed repositories. App-managed repositories will be stored in a sub-directory, each configuration in its own file. =head1 ISA L<Yukki::Settings::Privileges> =head1 ROLES L<Yukki::Role::Savable> =head1 ATTRIBUTES =head2 repository This is required. This is the name of the git repository folder found under C<repository_path>. =cut | ||||||
38 | |||||||
39 | has repository => ( | ||||||
40 | is => 'ro', | ||||||
41 | isa => Path, | ||||||
42 | required => 1, | ||||||
43 | coerce => 1, | ||||||
44 | ); | ||||||
45 | |||||||
46 - 50 | =head2 site_branch This is the 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. =cut | ||||||
51 | |||||||
52 | has site_branch => ( | ||||||
53 | is => 'ro', | ||||||
54 | isa => Str, | ||||||
55 | required => 1, | ||||||
56 | default => 'refs/heads/master', | ||||||
57 | ); | ||||||
58 | |||||||
59 - 63 | =head2 name This is a human readable title for the repository. =cut | ||||||
64 | |||||||
65 | has name => ( | ||||||
66 | is => 'ro', | ||||||
67 | isa => Str, | ||||||
68 | required => 1, | ||||||
69 | ); | ||||||
70 | |||||||
71 - 75 | =head2 default_page This is the name of the main repository index. =cut | ||||||
76 | |||||||
77 | has default_page => ( | ||||||
78 | is => 'ro', | ||||||
79 | isa => Path, | ||||||
80 | required => 1, | ||||||
81 | coerce => 1, | ||||||
82 | default => 'home.yukki', | ||||||
83 | ); | ||||||
84 | |||||||
85 - 89 | =head2 sort This is the sort order the repository should take when being listed in menus. The default is 50. The value must be an integer. =cut | ||||||
90 | |||||||
91 | has sort => ( | ||||||
92 | is => 'ro', | ||||||
93 | isa => Int, | ||||||
94 | required => 1, | ||||||
95 | default => 50, | ||||||
96 | ); | ||||||
97 | |||||||
98 - 104 | =head1 METHODS =head2 savable_attributes The list of savable attributes. =cut | ||||||
105 | |||||||
106 | sub savable_attributes { | ||||||
107 | 0 | 1 | qw( | ||||
108 | repository | ||||||
109 | site_page | ||||||
110 | name | ||||||
111 | default_page | ||||||
112 | sort | ||||||
113 | anonymous_access_level | ||||||
114 | read_groups | ||||||
115 | write_groups | ||||||
116 | ) | ||||||
117 | } | ||||||
118 | |||||||
119 | 1; |