[Bps-public-commit] r14780 - in Pushmi/trunk: . Pushmi-Admin/lib/Pushmi/Admin/Action Pushmi-Admin/lib/Pushmi/Admin/Model
alexmv at bestpractical.com
alexmv at bestpractical.com
Tue Aug 5 09:22:04 EDT 2008
Author: alexmv
Date: Tue Aug 5 09:22:03 2008
New Revision: 14780
Removed:
Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Model/HttpRoot.pm
Modified:
Pushmi/trunk/ (props changed)
Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin.pm
Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Action/CreateReplica.pm
Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Model/Replica.pm
Log:
r35296 at kohr-ah: chmrr | 2008-08-05 09:21:56 -0400
* Move HttpRoot model into Replica
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 Aug 5 09:22:03 2008
@@ -61,10 +61,10 @@
my $path = Jifty->config->app("apache")->{conf};
open(APACHE, ">", $path) or die "Can't write apache configuration file $path: $!";
- my $roots = Pushmi::Admin::Model::HttpRootCollection->new;
- $roots->unlimit;
+ my $replicas = Pushmi::Admin::Model::ReplicaCollection->new;
+ $replicas->unlimit;
print APACHE "PerlLoadModule Apache::AuthenHook\n";
- while (my $r = $roots->next) {
+ while (my $r = $replicas->next) {
print APACHE $r->apache_conf;
}
close(APACHE);
Modified: Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Action/CreateReplica.pm
==============================================================================
--- Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Action/CreateReplica.pm (original)
+++ Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Action/CreateReplica.pm Tue Aug 5 09:22:03 2008
@@ -24,15 +24,6 @@
return $self->validation_ok("url");
}
-around 'arguments' => sub {
- my ($next, $self) = @_;
- my $args = $next->($self);
- $args->{name}{ajax_validates} = 1;
- $args->{url}{ajax_validates} = 1;
- $args->{mirror} = {};
- return $args;
-};
-
sub record_class {'Pushmi::Admin::Model::Replica'}
sub report_success {}
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 Aug 5 09:22:03 2008
@@ -31,6 +31,10 @@
type is 'text',
is protected, valid_values are [qw/loading ok behind offline failed/];
+ column dav_root =>
+ type is 'text',
+ is unique, ajax validates;
+
};
sub validate_name {
@@ -63,21 +67,19 @@
$self->set_clean_name( $self->_clean_name );
}
+sub after_set_dav_root {
+ my $self = shift;
+ Pushmi::Admin->update_apache;
+}
+
sub create {
my $self = shift;
my %args = ( @_, status => "failed" );
- my $mirror = delete $args{mirror};
-
my ( $id, $msg ) = $self->SUPER::create(%args);
if ($id) {
$self->set_clean_name( $self->_clean_name );
- if ($mirror) {
- my $http = Pushmi::Admin::Model::HttpRoot->new;
- $http->create( path => $mirror, replica_id => $id );
- }
-
eval {
Pushmi::Command::Mirror->new->run( $self->svn_root, $self->url );
};
@@ -85,6 +87,7 @@
warn $err if $err;
}
+ Pushmi::Admin->update_apache;
return ( $id, $msg );
}
@@ -101,9 +104,6 @@
my $self = shift;
$self->stop_watcher;
$self->clear_cache;
- my $http = Pushmi::Admin::Model::HttpRootCollection->new;
- $http->limit( column => "replica_id", value => $self->id );
- $_->delete while $_ = $http->next;
rmtree( $self->svn_root );
return $self->SUPER::delete;
}
@@ -289,6 +289,26 @@
kill 2, $pid if $pid;
}
+sub apache_conf {
+ my $self = shift;
+ return <<EOT;
+<Location /@{[$self->dav_root]}>
+ DAV svn
+ SVNPath @{[$self->svn_root]}
+ PerlSetVar SVNPath @{[$self->svn_root]}
+ PerlSetVar Pushmi @{[Jifty->config->app("pushmi_bin")]}
+ PerlSetVar PushmiConfig /etc/pushmi.conf
+
+ <LimitExcept GET PROPFIND OPTIONS REPORT>
+ AuthName "Subversion repository for @{[$self->name]}"
+ AuthType Basic
+ Require valid-user
+ AuthBasicProvider Pushmi::Apache::RelayProvider
+ </LimitExcept>
+</Location>
+EOT
+}
+
sub current_user_can {
return 1;
}
More information about the Bps-public-commit
mailing list