[Bps-public-commit] r15875 - in Pushmi/trunk/Pushmi-Admin/lib/Pushmi: Admin/Model

clkao at bestpractical.com clkao at bestpractical.com
Tue Sep 9 13:51:45 EDT 2008


Author: clkao
Date: Tue Sep  9 13:51:44 2008
New Revision: 15875

Modified:
   Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin.pm
   Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Model/Replica.pm

Log:
* set JIFTY_APP_ROOT in apache config with perlsetenv.
* stub for apache 2.0 support.


Modified: Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin.pm
==============================================================================
--- Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin.pm	(original)
+++ Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin.pm	Tue Sep  9 13:51:44 2008
@@ -86,13 +86,18 @@
 sub update_apache {
     my $class = shift;
 
+    my $apache_vesrion = '2.2'; # XXX: detect 2.0
+
     my $path = Jifty->config->app("apache")->{conf};
     open(APACHE, ">", $path) or die "Can't write apache configuration file $path: $!";
     my $replicas = Pushmi::Admin::Model::ReplicaCollection->new;
     $replicas->unlimit;
-    print APACHE "PerlLoadModule Apache::AuthenHook\n";
+    print APACHE "PerlLoadModule Apache::AuthenHook\n"
+        if $apache_version ge '2.2';
     while (my $r = $replicas->next) {
-        print APACHE $r->apache_conf;
+        print APACHE $apache_version lt '2.2'
+            ? $r->apache_conf_20
+            : $r->apache_conf;
     }
     close(APACHE);
 

Modified: Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Model/Replica.pm
==============================================================================
--- Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Model/Replica.pm	(original)
+++ Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Model/Replica.pm	Tue Sep  9 13:51:44 2008
@@ -387,6 +387,28 @@
 EOT
 }
 
+sub apache_conf_20 {
+    my $self = shift;
+    return <<EOT;
+<Location /@{[$self->dav_root]}>
+    DAV svn
+    SVNPath @{[$self->svn_root]}
+
+    PerlSetEnv JIFTY_APP_ROOT @{[Jifty::Util->app_root]}
+    PerlSetVar SVNPath @{[$self->svn_root]}
+    PerlSetVar Pushmi @{[Jifty->config->app("pushmi_bin")]}
+    PerlSetVar PushmiConfig @{[$self->config_file]}
+
+    <LimitExcept GET PROPFIND OPTIONS REPORT>
+        AuthName "Subversion repository for @{[$self->name]}"
+        AuthType Basic
+        Require valid-user
+        PerlAuthenHandler Pushmi::Apache::AuthCommit
+    </LimitExcept>
+</Location>
+EOT
+}
+
 sub current_user_can {
     return 1;
 }



More information about the Bps-public-commit mailing list