« lib/Gitalist/Git/Types.pm
↑ Summary
lib/Gitalist/Git/CollectionOfRepositories/FromDirectoryRecursive.pm »
| 1 | 1 | ▶ | use MooseX::Declare; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 2 | 1 | ▶ | use Class::Load; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | |||||||||||||||||||||
| 4 | class Gitalist::Git::CollectionOfRepositories::Vhost | ||||||||||||||||||||
| 5 | 1 | ▶ | with Gitalist::Git::CollectionOfRepositoriesWithRequestState { | ||||||||||||||||||
|
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
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 1 | ▶ | use MooseX::Types::Moose qw/HashRef/; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 4 | ▶ | sub BUILDARGS { # FIXME - This is fuck ugly! | ||||||||||||||||||
|
Subroutine
BUILDARGS: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 9 | 4 | my ($class, @args) = @_; | |||||||||||||||||||
| 10 | 4 | my $args = $class->next::method(@args); | |||||||||||||||||||
| 11 | 4 | my %collections = %{ delete $args->{collections} }; | |||||||||||||||||||
| 12 | 4 | foreach my $name (keys %collections) { | |||||||||||||||||||
| 13 | 12 | my %args = %{$collections{$name}}; | |||||||||||||||||||
| 14 | 12 | my $class = delete $args{class}; | |||||||||||||||||||
| 15 | 12 | Class::Load::load_class($class); | |||||||||||||||||||
| 16 | 12 | $collections{$name} = $class->new(%args); | |||||||||||||||||||
| 17 | } | ||||||||||||||||||||
| 18 | 4 | my $ret = { %$args, collections => \%collections }; | |||||||||||||||||||
| 19 | 4 | return $ret; | |||||||||||||||||||
| 20 | } | ||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 1 | has collections => ( | |||||||||||||||||||
| 23 | is => 'ro', | ||||||||||||||||||||
| 24 | isa => HashRef, | ||||||||||||||||||||
| 25 | required => 1, | ||||||||||||||||||||
| 26 | ); | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 1 | has vhost_dispatch => ( | |||||||||||||||||||
| 29 | isa => HashRef, | ||||||||||||||||||||
| 30 | traits => ['Hash'], | ||||||||||||||||||||
| 31 | required => 1, | ||||||||||||||||||||
| 32 | handles => { | ||||||||||||||||||||
| 33 | _get_collection_name_for_vhost => 'get', | ||||||||||||||||||||
| 34 | }, | ||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | 1 | ▶ | method implementation_class { 'Gitalist::Git::CollectionOfRepositories::VhostImpl' } | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 38 | 1 | ▶ | method extract_request_state ($ctx) { | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
extract_request_state: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 39 | 4 | return (vhost => $ctx->uri->host); | |||||||||||||||||||
| 40 | 1 | } | |||||||||||||||||||
| 41 | 1 | ▶ | } | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | class Gitalist::Git::CollectionOfRepositories::VhostImpl | ||||||||||||||||||||
| 44 | 1 | ▶ | 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
| |||||||||||||||||||||
| 45 | 1 | ▶ | use MooseX::Types::Moose qw/ HashRef Str /; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 46 | 1 | ▶ | use MooseX::Types::Common::String qw/NonEmptySimpleStr/; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 47 | 1 | ▶ | use MooseX::Types::Path::Class qw/Dir/; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 48 | 1 | ▶ | use Moose::Util::TypeConstraints; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | 1 | has vhost_dispatch => ( | |||||||||||||||||||
| 51 | isa => HashRef, | ||||||||||||||||||||
| 52 | traits => ['Hash'], | ||||||||||||||||||||
| 53 | required => 1, | ||||||||||||||||||||
| 54 | handles => { | ||||||||||||||||||||
| 55 | _get_collection_name_for_vhost => 'get', | ||||||||||||||||||||
| 56 | }, | ||||||||||||||||||||
| 57 | ); | ||||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | 1 | has collections => ( | |||||||||||||||||||
| 60 | isa => HashRef, | ||||||||||||||||||||
| 61 | traits => ['Hash'], | ||||||||||||||||||||
| 62 | required => 1, | ||||||||||||||||||||
| 63 | handles => { | ||||||||||||||||||||
| 64 | _get_collection => 'get', | ||||||||||||||||||||
| 65 | } | ||||||||||||||||||||
| 66 | ); | ||||||||||||||||||||
| 67 | |||||||||||||||||||||
| 68 | 1 | has vhost => ( | |||||||||||||||||||
| 69 | is => 'ro', | ||||||||||||||||||||
| 70 | isa => Str, | ||||||||||||||||||||
| 71 | required => 1, | ||||||||||||||||||||
| 72 | ); | ||||||||||||||||||||
| 73 | |||||||||||||||||||||
| 74 | 0 | ▶ | method debug_string { 'chosen collection ' . ref($self->chosen_collection) . " " . $self->chosen_collection->debug_string } | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||
| 75 | |||||||||||||||||||||
| 76 | 1 | role_type 'Gitalist::Git::CollectionOfRepositories'; | |||||||||||||||||||
| 77 | has chosen_collection => ( | ||||||||||||||||||||
| 78 | is => 'ro', | ||||||||||||||||||||
| 79 | does => 'Gitalist::Git::CollectionOfRepositories', | ||||||||||||||||||||
| 80 | handles => [qw/ | ||||||||||||||||||||
| 81 | _get_repo_from_name | ||||||||||||||||||||
| 82 | _build_repositories | ||||||||||||||||||||
| 83 | /], | ||||||||||||||||||||
| 84 | 4 | ▶ | default => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=8.1
| |||||||||||||||||||||
| 85 | 4 | my $self = shift; | |||||||||||||||||||
| 86 | 4 | ▶ | $self->_get_collection($self->_get_collection_name_for_vhost($self->vhost) || $self->_get_collection_name_for_vhost('_default_')); | ||||||||||||||||||
|
Condition33%1/3
$self->_get_collection_name_for_vhost($self->vhost) || $self->_get_collection_name_for_vhost('_default_')
MC/DC0%0/2
$self->_get_collection_name_for_vhost($self->vhost) || $self->_get_collection_name_for_vhost('_default_')
$self->_get_collection_name_for_vhost($self->vhost)
$self->_get_collection_name_for_vhost('_default_')
Truth table33%1/3
A || B
A= $self->_get_collection_name_for_vhost($self->vhost)B= $self->_get_collection_name_for_vhost('_default_')
| |||||||||||||||||||||
| 87 | }, | ||||||||||||||||||||
| 88 | 1 | lazy => 1, | |||||||||||||||||||
| 89 | ); | ||||||||||||||||||||
| 90 | 1 | ▶ | } # end class | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 91 | |||||||||||||||||||||
| 92 | __END__ | ||||||||||||||||||||