« lib/Gitalist/Git/CollectionOfRepositories/FromDirectory/WhiteList.pm
↑ Summary
lib/Gitalist/ContentMangler/Resolver.pm »
| 1 | 1 | ▶ | use MooseX::Declare; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | |||
| 3 | 1 | ▶ | class Gitalist::Git::CollectionOfRepositories::FromListOfDirectories with Gitalist::Git::CollectionOfRepositories { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use MooseX::Types::Common::String qw/NonEmptySimpleStr/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use MooseX::Types::Moose qw/ ArrayRef HashRef /; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use MooseX::Types::Path::Class qw/Dir/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 1 | ▶ | use Gitalist::Git::Types qw/ ArrayRefOfDirs /; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 1 | ▶ | use File::Basename qw/basename/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 1 | ▶ | use Path::Class qw/dir/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 1 | ▶ | use Moose::Autobox; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | 1 | has repos => ( | |
| 13 | isa => ArrayRefOfDirs, | ||
| 14 | is => 'ro', | ||
| 15 | coerce => 1, | ||
| 16 | required => 1, | ||
| 17 | ); | ||
| 18 | 1 | has _repos_by_name => ( | |
| 19 | isa => HashRef[Dir], | ||
| 20 | is => 'ro', | ||
| 21 | lazy_build => 1, | ||
| 22 | traits => ['Hash'], | ||
| 23 | handles => { | ||
| 24 | _get_path_for_repository_name => 'get', | ||
| 25 | }, | ||
| 26 | ); | ||
| 27 | |||
| 28 | 0 | ▶ | method debug_string { 'repository directories ' . join(" ", map { $_."" } $self->repos->flatten) } |
|
Subroutine
BEGIN: called CC=1 SCAR=2.0
Subroutine
__ANON__: not called CC=1 SCAR=2.0
| |||
| 29 | |||
| 30 | 1 | ▶ | method _build__repos_by_name { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 31 | 1 | +{ map { basename($_) => dir($_) } $self->repos->flatten }; | |
| 32 | 1 | } | |
| 33 | |||
| 34 | 1 | ▶ | method _get_repo_from_name (NonEmptySimpleStr $name) { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 35 | 3 | return Git::Gitalist::Repository->new($self->_get_path_for_repository_name($name)); | |
| 36 | 1 | } | |
| 37 | |||
| 38 | ## Builders | ||
| 39 | 1 | ▶ | method _build_repositories { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 40 | 1 | [ map { $self->get_repository(basename($_)) } $self->repos->flatten ]; | |
| 41 | 1 | } | |
| 42 | 1 | ▶ | } # end class |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 43 | |||
| 44 | 1 | 1; | |
| 45 | |||
| 46 | =head1 NAME | ||
| 47 | |||
| 48 | Gitalist::Git::CollectionOfRepositories::FromListOfDirectories - Model of a collection of git repositories | ||
| 49 | |||
| 50 | =head1 SYNOPSIS | ||
| 51 | |||
| 52 | my $collection = Gitalist::Git::CollectionOfRepositories::FromListOfDirectories->new( repos => [qw/ | ||
| 53 | /path/to/repos1 | ||
| 54 | /path/to/repos2 | ||
| 55 | /] ); | ||
| 56 | my $repository_list = $collection->repositories; | ||
| 57 | my $first_repository = $repository_list->[0]; | ||
| 58 | my $named_repository = $repo->get_repository('Gitalist'); | ||
| 59 | |||
| 60 | =head1 DESCRIPTION | ||
| 61 | |||
| 62 | This class provides an abstraction for a list of Repository directories. | ||
| 63 | |||
| 64 | =head1 ATTRIBUTES | ||
| 65 | |||
| 66 | =head2 repos (C<< ArrayRef[NonEmptySimpleStr] >>) | ||
| 67 | |||
| 68 | A list of git repository directories | ||
| 69 | |||
| 70 | =head1 SEE ALSO | ||
| 71 | |||
| 72 | L<Gitalist::Git::CollectionOfRepositories>, L<Git::Gitalist::Repository> | ||
| 73 | |||
| 74 | =head1 AUTHORS | ||
| 75 | |||
| 76 | See L<Gitalist> for authors. | ||
| 77 | |||
| 78 | =head1 LICENSE | ||
| 79 | |||
| 80 | See L<Gitalist> for the license. | ||
| 81 | |||
| 82 | =cut | ||