[Catalyst-commits] r7145 - in trunk/Catalyst-Plugin-ConfigLoader: .
lib/Catalyst/Plugin t
bricas at dev.catalyst.perl.org
bricas at dev.catalyst.perl.org
Wed Nov 21 13:13:04 GMT 2007
Author: bricas
Date: 2007-11-21 13:13:04 +0000 (Wed, 21 Nov 2007)
New Revision: 7145
Added:
trunk/Catalyst-Plugin-ConfigLoader/t/21-mock_load_env.t
Modified:
trunk/Catalyst-Plugin-ConfigLoader/Changes
trunk/Catalyst-Plugin-ConfigLoader/lib/Catalyst/Plugin/ConfigLoader.pm
Log:
fixed suffix appending to explicit config paths.
Modified: trunk/Catalyst-Plugin-ConfigLoader/Changes
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader/Changes 2007-11-20 14:57:26 UTC (rev 7144)
+++ trunk/Catalyst-Plugin-ConfigLoader/Changes 2007-11-21 13:13:04 UTC (rev 7145)
@@ -1,5 +1,8 @@
Revision history for Perl extension Catalyst::Plugin::ConfigLoader.
+0.19 Wed Nov 21 2007
+ - fixed suffix appending to explicit config paths
+
0.18 Sat Oct 13 2007
- fix indentation on manual entry for DBIC::Schema config (Jeremy Wall)
RT #29967
Modified: trunk/Catalyst-Plugin-ConfigLoader/lib/Catalyst/Plugin/ConfigLoader.pm
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader/lib/Catalyst/Plugin/ConfigLoader.pm 2007-11-20 14:57:26 UTC (rev 7144)
+++ trunk/Catalyst-Plugin-ConfigLoader/lib/Catalyst/Plugin/ConfigLoader.pm 2007-11-21 13:13:04 UTC (rev 7145)
@@ -8,7 +8,7 @@
use Data::Visitor::Callback;
use Catalyst::Utils ();
-our $VERSION = '0.18';
+our $VERSION = '0.19';
=head1 NAME
@@ -113,7 +113,8 @@
my @files;
if ($extension) {
next unless grep { $_ eq $extension } @extensions;
- push @files, $path, "${path}_${suffix}";
+ ( my $local = $path ) =~ s{\.$extension}{_$suffix.$extension};
+ push @files, $path, $local;
} else {
@files = map { ( "$path.$_", "${path}_${suffix}.$_" ) } @extensions;
}
@@ -170,7 +171,7 @@
$path =~ s{[\/\\]$}{};
$path .= "/$prefix";
}
-
+
return( $path, $extension );
}
Added: trunk/Catalyst-Plugin-ConfigLoader/t/21-mock_load_env.t
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader/t/21-mock_load_env.t (rev 0)
+++ trunk/Catalyst-Plugin-ConfigLoader/t/21-mock_load_env.t 2007-11-21 13:13:04 UTC (rev 7145)
@@ -0,0 +1,24 @@
+package MockApp;
+
+use Test::More tests => 9;
+
+use Cwd;
+$ENV{ CATALYST_HOME } = cwd . '/t/mockapp';
+$ENV{ MOCKAPP_CONFIG } = $ENV{ CATALYST_HOME } . '/mockapp.pl';
+
+use_ok( 'Catalyst', qw( ConfigLoader ) );
+
+__PACKAGE__->config->{ 'Plugin::ConfigLoader' }->{ substitutions } = {
+ foo => sub { shift; join('-', @_); }
+};
+
+__PACKAGE__->setup;
+
+ok( __PACKAGE__->config );
+is( __PACKAGE__->config->{ 'Controller::Foo' }->{ foo }, 'bar' );
+is( __PACKAGE__->config->{ 'Controller::Foo' }->{ new }, 'key' );
+is( __PACKAGE__->config->{ 'Model::Baz' }->{ qux }, 'xyzzy' );
+is( __PACKAGE__->config->{ 'Model::Baz' }->{ another }, 'new key' );
+is( __PACKAGE__->config->{ 'view' }, 'View::TT::New' );
+is( __PACKAGE__->config->{ 'foo_sub' }, 'x-y' );
+is( __PACKAGE__->config->{ 'literal_macro' }, '__DATA__' );
More information about the Catalyst-commits
mailing list