1 package System::Introspector::Report::Builder::Repositories::Git::Locations;
4 extends 'System::Introspector::Report::Builder';
6 has collect_matching => (is => 'ro', default => sub { [] });
7 has _locations_by_origin => (is => 'lazy', default => sub { {} });
17 my ($self, $origin) = @_;
18 my @match_rx = @{ $self->collect_matching };
19 for my $rx (@match_rx) {
20 if ($origin =~ qr{^$rx$}i) {
28 my ($self, $remote, $data) = @_;
29 my $git = $data->{'repositories/git'}{git} || {};
30 for my $location (keys %$git) {
31 my $origin = $git->{$location}{config}{contents}{'remote.origin.url'}
33 my $matched = $self->_match_origin($origin)
35 push @{$self->_locations_by_origin->{$matched}}, {
37 hostname => $data->{host}{hostname},
38 location => $location,
48 { key => 'remote', label => 'Remote Host' },
49 { key => 'hostname', label => 'Hostname' },
50 { key => 'location', label => 'Location' },
52 my $collected = $self->_locations_by_origin;
55 my $rows = $collected->{$identifier};
57 columns => [@columns],
58 title => "$identifier Checkouts",
59 id => ['repositories-git-locations', $identifier],
60 rowid => [qw( remote location )],
61 meta => { repository => $identifier },
64 ($a->{remote} cmp $b->{remote})
66 ($a->{location} cmp $b->{location})