File Coverage

blib/lib/Docker/Registry/Gitlab.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             package Docker::Registry::Gitlab;
2 1     1   13801 use Moo;
  1         2  
  1         5  
3 1     1   339 use Types::Standard qw/Str/;
  1         2  
  1         7  
4             extends 'Docker::Registry::V2';
5 1     1   518 use namespace::autoclean;
  1         2  
  1         8  
6              
7             # ABSTRACT: Be able to talk to the gitlab registry
8              
9 1     1   510 use Docker::Registry::Types qw(DockerRegistryURI);
  1         2  
  1         12  
10              
11             has '+url' => (
12             lazy => 1,
13             default => sub {
14             my $self = shift;
15             'https://registry.gitlab.com';
16             }
17             );
18              
19             has 'username' => (
20             is => 'ro',
21             isa => Str,
22             required => 1,
23             );
24              
25             has 'access_token' => (
26             is => 'ro',
27             isa => Str,
28             required => 1,
29             );
30              
31             has 'jwt' => (
32             is => 'ro',
33             isa => DockerRegistryURI,
34             predicate => 'has_jwt',
35             );
36              
37             has 'repo' => (
38             is => 'ro',
39             isa => Str,
40             predicate => 'has_repo',
41             );
42              
43             around build_auth => sub {
44             my ($orig, $self) = @_;
45             require Docker::Registry::Auth::Gitlab;
46             return Docker::Registry::Auth::Gitlab->new(
47             username => $self->username,
48             access_token => $self->access_token,
49             $self->has_jwt ? (jwt => $self->jwt) : (),
50             );
51             };
52              
53             around 'repositories' => sub {
54             die "_catalog operation is not supported by GitLab provider";
55             };
56              
57             __PACKAGE__->meta->make_immutable;
58              
59             __END__