1 package App::Rgit::Config;
8 use File::Spec::Functions qw/file_name_is_absolute/;
10 use Object::Tiny qw/root git cwd_repo debug/;
12 use App::Rgit::Repository;
13 use App::Rgit::Utils qw/validate :levels/;
15 use constant IS_WIN32 => $^O eq 'MSWin32';
19 App::Rgit::Config - Base class for App::Rgit configurations.
27 our $VERSION = '0.05';
31 Base class for L<App::Rgit> configurations.
33 This is an internal class to L<rgit>.
37 =head2 C<< new root => $root, git => $git >>
39 Creates a new configuration object based on the root directory C<$root> and using C<$git> as F<git> executable.
44 my ($class, %args) = &validate;
46 my $root = $args{root};
47 return unless defined $root and -d $root;
48 $root = abs_path $root unless file_name_is_absolute $root;
51 return unless defined $git;
55 return unless -x $git;
58 return unless -x $git;
61 my $conf = 'App::Rgit::Config::Default';
62 eval "require $conf; 1" or croak "Couldn't load $conf: $@";
64 my $r = App::Rgit::Repository->new(fake => 1);
65 return unless defined $r;
71 debug => defined $args{debug} ? int $args{debug} : WARN,
83 Notifies a message C<$msg> of the corresponding level.
90 if ($self->debug >= $level) {
97 sub info { shift->_notify(INFO, @_) }
99 sub warn { shift->_notify(WARN, @_) }
101 sub err { shift->_notify(ERR, @_) }
103 sub crit { shift->_notify(CRIT, @_) }
123 Vincent Pit, C<< <perl at profvince.com> >>, L<http://profvince.com>.
125 You can contact me by mail or on C<irc.perl.org> (vincent).
129 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.
133 You can find documentation for this module with the perldoc command.
135 perldoc App::Rgit::Config
137 =head1 COPYRIGHT & LICENSE
139 Copyright 2008 Vincent Pit, all rights reserved.
141 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
145 1; # End of App::Rgit::Config