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