Commit | Line | Data |
b70462a4 |
1 | use MooseX::Declare; |
2 | |
3 | class Gitalist::Git::CollectionOfRepositories::FromDirectory::WhiteList |
4 | extends Gitalist::Git::CollectionOfRepositories::FromDirectory { |
5 | use MooseX::Types::Common::String qw/NonEmptySimpleStr/; |
6 | use MooseX::Types::Path::Class qw/File Dir/; |
7 | |
8 | has whitelist => ( |
9 | isa => File, |
10 | is => 'ro', |
11 | required => 1, |
12 | coerce => 1, |
13 | ); |
14 | |
13c42902 |
15 | method debug_string { 'repository directory ' . $self->repo_dir . ' whitelist file ' . $self->whitelist } |
16 | |
b70462a4 |
17 | method _build_repositories { |
18 | return [ |
19 | map Gitalist::Git::Repository->new($_), |
20 | grep -d $_, |
dfbedbb4 |
21 | map $self->repo_dir->subdir($_), |
22 | map [split]->[0], $self->whitelist->slurp(chomp => 1) |
b70462a4 |
23 | ]; |
24 | } |
25 | } |
26 | |
27 | __END__ |
28 | =head1 NAME |
29 | |
30 | Gitalist::Git::CollectionOfRepositories::FromDirectory::WhiteList - Model of a repositories listed in a file in a given directory. |
31 | |
32 | =head1 SYNOPSIS |
33 | |
34 | my $repo = Gitalist::Git::CollectionOfRepositories::FromDirectory::WhiteList->new( |
35 | repo_dir => $Dir, |
36 | whitelist => 'projects.list', |
37 | ); |
38 | my $repository_list = $repo->repositories; |
39 | my $first_repository = $repository_list->[0]; |
40 | my $named_repository = $repo->get_repository('Gitalist'); |
41 | |
42 | =head1 DESCRIPTION |
43 | |
44 | This class provides a list of Repositories found in the given |
45 | directory and specified in a given whitelist file. |
46 | |
47 | =head1 ATTRIBUTES |
48 | |
49 | =head2 whitelist (C<Path::Class::File>) |
50 | |
51 | The file containing the available repositories. Each line specifies a |
52 | different repository within L</repo_dir>. |
53 | |
54 | =head1 SEE ALSO |
55 | |
56 | L<Gitalist::Git::CollectionOfRepositories>, |
fe89796b |
57 | L<Gitalist::Git::Repository>, |
b70462a4 |
58 | L<Gitalist::Git::CollectionOfRepositories::FromDirectory> |
59 | |
60 | =head1 AUTHORS |
61 | |
62 | See L<Gitalist> for authors. |
63 | |
64 | =head1 LICENSE |
65 | |
66 | See L<Gitalist> for the license. |
67 | |
68 | =cut |