Merge
[catagits/Gitalist.git] / lib / Gitalist.pm
index 8d3f4f5..535a239 100644 (file)
@@ -6,30 +6,35 @@ use Catalyst::Runtime 5.80;
 
 extends 'Catalyst';
 
-use Catalyst qw/-Debug
+use Catalyst qw/
                 ConfigLoader
                 Static::Simple
-                               StackTrace/;
+                StackTrace/;
+
 our $VERSION = '0.01';
 
 # Bring in the libified gitweb.cgi.
 use gitweb;
 
-# Load the testing config if we're invoked under test
-if ($ENV{APP_TEST} ) {
-  __PACKAGE__->config( 'Plugin::ConfigLoader' =>
-                       { file => __PACKAGE__->path_to
-                         ('t/lib/gitalist_testing.conf')}
-                     );
-}
 __PACKAGE__->config(
-       name => 'Gitalist',
-       default_view => 'Default',
+    name => 'Gitalist',
+    default_view => 'Default',
 );
 
 # Start the application
 __PACKAGE__->setup();
 
+around uri_for => sub {
+  my ($orig, $c) = (shift, shift);
+  my $params = Catalyst::Utils::merge_hashes(
+    { p => $c->model('Git')->project },
+    ref($_[-1]) eq 'HASH' ? pop @_ : {}
+  );
+  (my $uri = $c->$orig(@_, $params))
+    =~ tr[&][;];
+  return $uri;
+};
+
 =head1 NAME
 
 Gitalist - Catalyst based application