[Bps-public-commit] r14791 - in Pushmi/trunk: . Pushmi-Admin/etc Pushmi-Admin/lib/Pushmi/Admin Pushmi-Admin/lib/Pushmi/Admin/Model Pushmi-Admin/var/svn_root

alexmv at bestpractical.com alexmv at bestpractical.com
Tue Aug 5 13:24:18 EDT 2008


Author: alexmv
Date: Tue Aug  5 13:24:17 2008
New Revision: 14791

Added:
   Pushmi/trunk/Pushmi-Admin/var/data/
Removed:
   Pushmi/trunk/Pushmi-Admin/var/svn_root/
Modified:
   Pushmi/trunk/   (props changed)
   Pushmi/trunk/Pushmi-Admin/etc/config.yml
   Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Model/Replica.pm
   Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/View.pm

Log:
 r35328 at kohr-ah:  chmrr | 2008-08-05 13:24:01 -0400
  * Fix 'mirror' arg in mutlipage create
  * Rearrange var to contain data/projectname/{svn,conf}
  * Replicas now have their own config, logconf, and log files


Modified: Pushmi/trunk/Pushmi-Admin/etc/config.yml
==============================================================================
--- Pushmi/trunk/Pushmi-Admin/etc/config.yml	(original)
+++ Pushmi/trunk/Pushmi-Admin/etc/config.yml	Tue Aug  5 13:24:17 2008
@@ -55,7 +55,7 @@
     StaticRoot: share/web/static
     TemplateRoot: share/web/templates
 application:
-    svn_root: %var/svn_root%
+    data_root: %var/data%
     pushmi_bin: /usr/bin/pushmi
     apache:
       root: http://localhost/

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 13:24:17 2008
@@ -6,6 +6,7 @@
 
 use File::Path;
 use File::Spec;
+use YAML;
 use Pushmi::Mirror;
 use Pushmi::Command::Mirror;
 use Pushmi::Command::Sync;
@@ -80,14 +81,27 @@
     if ($id) {
         $self->set_clean_name( $self->_clean_name );
 
+        mkpath( $self->file_root );
         eval {
             Pushmi::Command::Mirror->new->run( $self->svn_root, $self->url );
         };
         my $err = $@;
 
         warn $err if $err;
+        YAML::DumpFile( $self->config_file, { username => undef, password => undef, authproxy_port => 11211 });
+        open(LOG, ">", $self->log_config_file ) or die "Can't write log config file @{[$self->log_config_file]}: $!";
+        print LOG <<EOT;
+log4perl.rootLogger=DEBUG, Logfile
+
+log4perl.appender.Logfile=Log::Log4perl::Appender::File
+log4perl.appender.Logfile.filename=@{[$self->file_root]}/pushmi.log
+log4perl.appender.Logfile.mode=append
+log4perl.appender.Logfile.layout=PatternLayout
+log4perl.appender.Logfile.layout.ConversionPattern = [%P][%r] %c - %m%n
+EOT
+        close LOG;
+        Pushmi::Admin->update_apache;
     }
-    Pushmi::Admin->update_apache;
 
     return ( $id, $msg );
 }
@@ -104,7 +118,7 @@
     my $self = shift;
     $self->stop_watcher;
     $self->clear_cache;
-    rmtree( $self->svn_root );
+    rmtree( $self->file_root );
     return $self->SUPER::delete;
 }
 
@@ -122,9 +136,9 @@
     my ($bootstrap) = @_;
 
     unless (fork) {
-        my @args = ($^X, Jifty->config->app("pushmi_bin"), "sync", $self->svn_root, "--silent");
+        $ENV{PUSHMI_CONFIG} = $self->config_file;
+        my @args = ($^X, "-I/home/chmrr/work/bps/Pushmi/lib", Jifty->config->app("pushmi_bin"), "sync", $self->svn_root, "--silent");
         push @args, "--bootstrap", $bootstrap if $bootstrap;
-
         exec(@args);
     }
     $self->clear_cache;
@@ -141,10 +155,28 @@
     close DUMP;
 }
 
+sub file_root {
+    my $self = shift;
+    my @parts = File::Spec->splitpath( Jifty->config->app('data_root') );
+    return File::Spec->catfile( @parts, $self->clean_name );
+}
+
+sub config_file {
+    my $self = shift;
+    my @parts = File::Spec->splitpath( $self->file_root );
+    return File::Spec->catfile( @parts, "pushmi.conf" );
+}
+
+sub log_config_file {
+    my $self = shift;
+    my @parts = File::Spec->splitpath( $self->file_root );
+    return File::Spec->catfile( @parts, "pushmi-log.conf" );
+}
+
 sub svn_root {
     my $self  = shift;
-    my @parts = File::Spec->splitpath( Jifty->config->app('svn_root') );
-    return File::Spec->catfile( @parts, $self->clean_name );
+    my @parts = File::Spec->splitpath( $self->file_root );
+    return File::Spec->catfile( @parts, "svn" );
 }
 
 sub cache {
@@ -297,7 +329,7 @@
     SVNPath @{[$self->svn_root]}
     PerlSetVar SVNPath @{[$self->svn_root]}
     PerlSetVar Pushmi @{[Jifty->config->app("pushmi_bin")]}
-    PerlSetVar PushmiConfig /etc/pushmi.conf
+    PerlSetVar PushmiConfig @{[$self->config_file]}
 
     <LimitExcept GET PROPFIND OPTIONS REPORT>
         AuthName "Subversion repository for @{[$self->name]}"

Modified: Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/View.pm
==============================================================================
--- Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/View.pm	(original)
+++ Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/View.pm	Tue Aug  5 13:24:17 2008
@@ -77,7 +77,7 @@
 
             render_param( $new => "name", default_value => $new->argument_value("name") );
             outs_raw( $new->form_value("url", default_value => $new->argument_value("url")) );
-            render_param( $new => "mirror" );
+            render_param( $new => "dav_root" );
             div {
                 {class is "submit_button"};
                 outs_raw( $new->finish_button( label => "Create", url => "/created", class => "submit" ) );



More information about the Bps-public-commit mailing list