]> git.vpit.fr Git - perl/modules/rgit.git/blob - lib/App/Rgit/Config/Default.pm
Don't chdir() when searching for git repositories
[perl/modules/rgit.git] / lib / App / Rgit / Config / Default.pm
1 package App::Rgit::Config::Default;
2
3 use strict;
4 use warnings;
5
6 use File::Find qw/find/;
7
8 use base qw/App::Rgit::Config/;
9
10 use App::Rgit::Repository;
11
12 =head1 NAME
13
14 App::Rgit::Config::Default - Default App::Rgit configuration class.
15
16 =head1 VERSION
17
18 Version 0.06
19
20 =cut
21
22 our $VERSION = '0.06';
23
24 =head1 DESCRIPTION
25
26 Default L<App::Rgit> configuration class.
27
28 This is an internal class to L<rgit>.
29
30 =head1 METHODS
31
32 This class inherits from L<App::Rgit::Config>.
33
34 It implements :
35
36 =head2 C<repos>
37
38 =cut
39
40 sub repos {
41  my $self = shift;
42  return $self->{repos} if defined $self->{repos};
43  my %repos;
44  find {
45   wanted => sub {
46    return if m{(?:^|/)\.\.?$}
47           or not (-d $_ and -r _);
48    my $r = App::Rgit::Repository->new(dir => $_);
49    $repos{$r->repo} = $r if $r
50                          and not exists $repos{$r->repo};
51   },
52   follow   => 1,
53   no_chdir => 1,
54  }, $self->root;
55  $self->{repos} = [ sort { $a->repo cmp $b->repo } values %repos ];
56 }
57
58 =head1 SEE ALSO
59
60 L<rgit>.
61
62 =head1 AUTHOR
63
64 Vincent Pit, C<< <perl at profvince.com> >>, L<http://profvince.com>.
65
66 You can contact me by mail or on C<irc.perl.org> (vincent).
67
68 =head1 BUGS
69
70 Please report any bugs or feature requests to C<bug-rgit at rt.cpan.org>, or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=rgit>.  I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
71
72 =head1 SUPPORT
73
74 You can find documentation for this module with the perldoc command.
75
76     perldoc App::Rgit::Command::Default
77
78 =head1 COPYRIGHT & LICENSE
79
80 Copyright 2008-2009 Vincent Pit, all rights reserved.
81
82 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
83
84 =cut
85
86 1; # End of App::Rgit::Command::Default