Permalink
Browse files

Make it more clear where to find the config files. This also makes

testing easier.
  • Loading branch information...
1 parent 96a0ecc commit 179794a637ebf41879179e91a6164d2bb0fbc295 @kaare committed May 12, 2012
Showing with 18 additions and 6 deletions.
  1. +2 −2 etc/jet.conf
  2. +7 −1 lib/Jet/Context.pm
  3. +9 −3 lib/Jet/Context/Config.pm
View
@@ -1,4 +1,4 @@
-connect_info album
+connect_info __jet_test__
connect_info kaare
connect_info
<connect_info>
@@ -19,4 +19,4 @@ template_suffix .tx
url images
file public/images/
</image>
-</paths>
+</paths>
View
@@ -72,12 +72,18 @@ has jet_root => (
return $path;
},
);
+has configbase => (
+ isa => 'Str',
+ is => 'ro',
+ default => 'etc/',
+);
has config => (
isa => 'Jet::Context::Config',
is => 'ro',
lazy => 1,
default => sub {
- return Jet::Context::Config->new;
+ my $self = shift;
+ return Jet::Context::Config->new(base => $self->configbase);
},
);
has schema => (
View
@@ -29,13 +29,19 @@ The options part of the config
=cut
+has base => (
+ isa => 'Str',
+ is => 'ro',
+ default => 'etc/',
+);
has config => (
isa => 'HashRef',
is => 'ro',
default => sub {
my $self = shift;
+ chdir $self->base;
my $config_total = Config::Any->load_files({
- files => [glob 'etc/*'],
+ files => [glob '*'],
use_ext => 1,
flatten_to_hash => 1,
});
@@ -47,15 +53,15 @@ has jet => (
is => 'ro',
default => sub {
my $self = shift;
- return $self->config->{'etc/jet.conf'};
+ return $self->config->{'jet.conf'};
},
);
has options => (
isa => 'HashRef',
is => 'ro',
default => sub {
my $self = shift;
- return $self->config->{'etc/options.conf'};
+ return $self->config->{'options.conf'};
},
);

0 comments on commit 179794a

Please sign in to comment.