]> git.vpit.fr Git - perl/modules/rgit.git/blob - lib/App/Rgit/Config.pm
846006ee97ddab1ddc7b00662527cba95b1507d1
[perl/modules/rgit.git] / lib / App / Rgit / Config.pm
1 package App::Rgit::Config;
2
3 use strict;
4 use warnings;
5
6 use Carp qw/croak/;
7 use Cwd qw/abs_path/;
8 use File::Spec::Functions qw/file_name_is_absolute/;
9
10 use Object::Tiny qw/root git/;
11
12 use App::Rgit::Utils qw/validate/;
13
14 =head1 NAME
15
16 App::Rgit::Config - Base class for App::Rgit configurations.
17
18 =head1 VERSION
19
20 Version 0.02
21
22 =cut
23
24 our $VERSION = '0.02';
25
26 =head1 DESCRIPTION
27
28 Base class for L<App::Rgit> configurations.
29
30 This is an internal class to L<rgit>.
31
32 =head1 METHODS
33
34 =head2 C<< new root => $root, git => $git >>
35
36 Creates a new configuration object based on the root directory C<$root> and using C<$git> as F<git> executable.
37
38 =cut
39
40 sub new {
41  my ($class, %args) = &validate;
42  my $root = $args{root};
43  return unless defined $root and -d $root;
44  $root = abs_path $root unless file_name_is_absolute $root;
45  return unless defined $args{git} and -x $args{git};
46  my $conf = 'App::Rgit::Config::Default';
47  eval "require $conf; 1" or croak "Couldn't load $conf: $@";
48  $conf->SUPER::new(
49   root => $args{root},
50   git  => $args{git},
51  );
52 }
53
54 =head2 C<root>
55
56 =head2 C<git>
57
58 =head2 C<repos>
59
60 Accessors.
61
62 =head1 SEE ALSO
63
64 L<rgit>.
65
66 =head1 AUTHOR
67
68 Vincent Pit, C<< <perl at profvince.com> >>, L<http://profvince.com>.
69    
70 You can contact me by mail or on C<irc.perl.org> (vincent).
71
72 =head1 BUGS
73
74 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.
75
76 =head1 SUPPORT
77
78 You can find documentation for this module with the perldoc command.
79
80     perldoc App::Rgit::Config
81
82 =head1 COPYRIGHT & LICENSE
83
84 Copyright 2008 Vincent Pit, all rights reserved.
85
86 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
87
88 =cut
89
90 1; # End of App::Rgit::Config