| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Group::Git::Gitosis; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Created on: 2013-05-04 20:18:43 |
|
4
|
|
|
|
|
|
|
# Create by: Ivan Wills |
|
5
|
|
|
|
|
|
|
# $Id$ |
|
6
|
|
|
|
|
|
|
# $Revision$, $HeadURL$, $Date$ |
|
7
|
|
|
|
|
|
|
# $Revision$, $Source$, $Date$ |
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
1225
|
use Moo; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
7
|
|
|
10
|
1
|
|
|
1
|
|
2744
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
23
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
28
|
|
|
12
|
1
|
|
|
1
|
|
5
|
use version; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
13
|
|
|
13
|
1
|
|
|
1
|
|
97
|
use Carp; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
61
|
|
|
14
|
1
|
|
|
1
|
|
7
|
use English qw/ -no_match_vars /; |
|
|
1
|
|
|
|
|
14
|
|
|
|
1
|
|
|
|
|
11
|
|
|
15
|
1
|
|
|
1
|
|
439
|
use Path::Tiny; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
56
|
|
|
16
|
1
|
|
|
1
|
|
8
|
use File::chdir; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
500
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = version->new('0.7.7'); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
extends 'Group::Git'; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _repos { |
|
23
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
|
24
|
|
|
|
|
|
|
|
|
25
|
0
|
0
|
|
|
|
|
if ( -d '.gitosis' ) { |
|
26
|
0
|
|
|
|
|
|
local $CWD = '.gitosis'; |
|
27
|
0
|
|
|
|
|
|
system 'git', 'pull'; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
else { |
|
30
|
0
|
|
|
|
|
|
system 'git', 'clone', $self->conf->{gitosis}, '.gitosis'; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my $data = Config::Any->load_files({ |
|
34
|
|
|
|
|
|
|
files => ['.gitosis/gitosis.conf'], |
|
35
|
|
|
|
|
|
|
use_ext => 0, |
|
36
|
|
|
|
|
|
|
force_plugins => ['Config::Any::INI'], |
|
37
|
|
|
|
|
|
|
}); |
|
38
|
|
|
|
|
|
|
$data = { |
|
39
|
|
|
|
|
|
|
map { |
|
40
|
0
|
|
|
|
|
|
%$_ |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
map { |
|
43
|
0
|
|
|
|
|
|
values %$_ |
|
44
|
|
|
|
|
|
|
} |
|
45
|
0
|
|
|
|
|
|
@{$data} |
|
|
0
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
}; |
|
47
|
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
my $base = $self->conf->{gitosis}; |
|
49
|
0
|
|
|
|
|
|
$base =~ s{([:/]).*?$}{$1}; |
|
50
|
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
my %repos = %{ $self->SUPER::_repos() }; |
|
|
0
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
for my $group ( keys %$data ) { |
|
53
|
0
|
|
|
|
|
|
for my $sub_group ( keys %{ $data->{$group} } ) { |
|
|
0
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
for my $type (qw/readonly writable/) { |
|
55
|
0
|
0
|
|
|
|
|
next if !$data->{$group}{$sub_group}{$type}; |
|
56
|
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
for my $name ( split /\s+/, $data->{$group}{$sub_group}{$type} ) { |
|
58
|
0
|
|
|
|
|
|
$repos{$name} = Group::Git::Repo->new( |
|
59
|
|
|
|
|
|
|
name => path($name), |
|
60
|
|
|
|
|
|
|
git => "$base$name.git", |
|
61
|
|
|
|
|
|
|
); |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
return \%repos; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 NAME |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Group::Git::Gitosis - Adds reading all repositories you have access to on a gitosis host |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 VERSION |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This documentation refers to Group::Git::Gitosis version 0.7.7. |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
use Group::Git::Gitosis; |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# pull (or clone missing) all repositories that joeblogs has created/forked |
|
87
|
|
|
|
|
|
|
my $ggg = Group::Git::Github->new( |
|
88
|
|
|
|
|
|
|
conf => { |
|
89
|
|
|
|
|
|
|
gitosis => 'git://gitosis/url', |
|
90
|
|
|
|
|
|
|
}, |
|
91
|
|
|
|
|
|
|
); |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
# list all repositories |
|
94
|
|
|
|
|
|
|
my $repositories = $ggg->repo(); |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
# do something to each repository |
|
97
|
|
|
|
|
|
|
for my $repo (keys %{$repositories}) { |
|
98
|
|
|
|
|
|
|
# eg do a pull |
|
99
|
|
|
|
|
|
|
$ggg->pull($repo); |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Reads all repositories you have access to (via standard git username). You |
|
105
|
|
|
|
|
|
|
must have read access to the .gitosis repository. |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 DIAGNOSTICS |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 CONFIGURATION AND ENVIRONMENT |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
There are no known bugs in this module. |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Please report problems to Ivan Wills (ivan.wills@gmail.com). |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Patches are welcome. |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 AUTHOR |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Ivan Wills - (ivan.wills@gmail.com) |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Copyright (c) 2013 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077). |
|
132
|
|
|
|
|
|
|
All rights reserved. |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it under |
|
135
|
|
|
|
|
|
|
the same terms as Perl itself. See L<perlartistic>. This program is |
|
136
|
|
|
|
|
|
|
distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
|
137
|
|
|
|
|
|
|
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
|
138
|
|
|
|
|
|
|
PARTICULAR PURPOSE. |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=cut |