]> git.vpit.fr Git - perl/modules/rgit.git/blob - lib/App/Rgit.pm
1c8873d714b3a8a360a6091c38f123b658467a39
[perl/modules/rgit.git] / lib / App / Rgit.pm
1 package App::Rgit;
2
3 use strict;
4 use warnings;
5
6 use App::Rgit::Command;
7 use App::Rgit::Config;
8 use App::Rgit::Utils qw/validate/;
9
10 =head1 NAME
11
12 App::Rgit - Backend that supports the rgit utility.
13
14 =head1 VERSION
15
16 Version 0.06
17
18 =cut
19
20 our $VERSION = '0.06';
21
22 =head1 DESCRIPTION
23
24 Backend that supports the L<rgit> utility.
25
26 This is an internal class to L<rgit>.
27
28 =head1 METHODS
29
30 =head2 C<< new root => $root, git => $git, cmd => $cmd, args => \@args >>
31
32 Creates a new L<App::Rgit> object that's bound to execute the command C<$cmd> on all the C<git> repositories inside C<$root> with C<@args> as arguments and C<$git> as C<git> executable.
33
34 =cut
35
36 sub new {
37  my ($class, %args) = &validate;
38  my $config = App::Rgit::Config->new(
39   root  => $args{root},
40   git   => $args{git},
41   debug => $args{debug},
42  );
43  return unless defined $config;
44  my $command = App::Rgit::Command->new(
45   cmd    => $args{cmd},
46   args   => $args{args},
47   policy => $args{policy},
48  );
49  return unless defined $command;
50  bless {
51   config  => $config,
52   command => $command,
53  }, $class;
54 }
55
56 =head2 C<run>
57
58 Actually run the commands.
59
60 =cut
61
62 sub run {
63  my $self = shift;
64  $self->command->run($self->config);
65 }
66
67 =head2 C<config>
68
69 =head2 C<command>
70
71 Read-only accessors.
72
73 =cut
74
75 BEGIN {
76  eval "sub $_ { \$_[0]->{$_} }" for qw/config command/;
77 }
78
79 =head1 SEE ALSO
80
81 L<rgit>.
82
83 =head1 AUTHOR
84
85 Vincent Pit, C<< <perl at profvince.com> >>, L<http://profvince.com>.
86
87 You can contact me by mail or on C<irc.perl.org> (vincent).
88
89 =head1 BUGS
90
91 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.
92
93 =head1 SUPPORT
94
95 You can find documentation for this module with the perldoc command.
96
97     perldoc App::Rgit
98
99 =head1 COPYRIGHT & LICENSE
100
101 Copyright 2008-2009 Vincent Pit, all rights reserved.
102
103 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
104
105 =cut
106
107 1; # End of App::Rgit