[Bps-public-commit] r16545 - in sd/trunk: . lib/App/SD
spang at bestpractical.com
spang at bestpractical.com
Sun Oct 26 17:09:01 EDT 2008
Author: spang
Date: Sun Oct 26 17:08:59 2008
New Revision: 16545
Added:
sd/trunk/lib/App/SD/Config.pm
Modified:
sd/trunk/ (props changed)
sd/trunk/lib/App/SD.pm
Log:
r50903 at loki: spang | 2008-10-25 22:42:38 -0400
let sd have its own config file
Modified: sd/trunk/lib/App/SD.pm
==============================================================================
--- sd/trunk/lib/App/SD.pm (original)
+++ sd/trunk/lib/App/SD.pm Sun Oct 26 17:08:59 2008
@@ -1,9 +1,16 @@
package App::SD;
use Moose;
+use App::SD::Config;
extends 'Prophet::App';
our $VERSION = '0.01';
+has +config => (
+ default => sub {
+ my $self = shift;
+ return App::SD::Config->new(app_handle => $self);
+ }
+);
sub database_settings {
{
Added: sd/trunk/lib/App/SD/Config.pm
==============================================================================
--- (empty file)
+++ sd/trunk/lib/App/SD/Config.pm Sun Oct 26 17:08:59 2008
@@ -0,0 +1,27 @@
+package App::SD::Config;
+use Moose;
+use File::Spec;
+
+extends 'Prophet::Config';
+
+# We can't just frob $ENV{PROPHET_APP_CONFIG} the way the sd script does
+# with $ENV{PROPHET_REPO} because we need to instantiate App::SD::CLI to
+# get the location of the repo root, and then Prophet would load its own
+# config file before we got around to messing with the env var
+before 'app_config_file' => sub {
+ my $self = shift;
+
+ $ENV{'PROPHET_APP_CONFIG'} = $self->file_if_exists($ENV{'SD_CONFIG'})
+ || $self->file_if_exists(
+ File::Spec->catfile($self->app_handle->handle->fs_root => 'sdrc'))
+ || $self->file_if_exists(
+ # backcompat
+ File::Spec->catfile($self->app_handle->handle->fs_root => 'prophetrc'))
+ || $self->file_if_exists(
+ File::Spec->catfile($ENV{'HOME'}.'/.sdrc'));
+};
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
+1;
More information about the Bps-public-commit
mailing list