[Rt-commit] r5951 - in commitbit: . share/web/templates/admin

jesse at bestpractical.com jesse at bestpractical.com
Sat Sep 16 16:20:09 EDT 2006


Author: jesse
Date: Sat Sep 16 16:20:09 2006
New Revision: 5951

Modified:
   commitbit/   (props changed)
   commitbit/lib/CommitBit/Model/Repository.pm
   commitbit/share/web/templates/admin/create_repository

Log:
 r27569 at pinglin:  jesse | 2006-09-16 21:20:05 +0100
 * misc fixups


Modified: commitbit/lib/CommitBit/Model/Repository.pm
==============================================================================
--- commitbit/lib/CommitBit/Model/Repository.pm	(original)
+++ commitbit/lib/CommitBit/Model/Repository.pm	Sat Sep 16 16:20:09 2006
@@ -5,6 +5,7 @@
 package CommitBit::Model::Repository;
 use Jifty::DBI::Schema;
 use File::Spec;
+use File::Path;
 use Cwd 'abs_path';
 
 use CommitBit::Record schema {
@@ -94,7 +95,6 @@
     my $args = { @_ };
     my $prefix = abs_path( Jifty->config->app("repository_prefix") );
 
-    warn "That means my prefix is ".$prefix;
 
     if (exists $args->{local_path} and length $args->{local_path}) {
              if ( ! File::Spec->file_name_is_absolute( $args->{'local_path'} )) {
@@ -102,23 +102,41 @@
              }
 
     } else {
-	$args->{local_path} = File::Spec->catdir($prefix, $args->{name});
+        	$args->{local_path} = File::Spec->catdir($prefix, $args->{name});
     }
 
-    my ($id, $msg) = $self->SUPER::create(%$args);
-
-    if ($id) {
-	# XXX: when failed rollback the create?
+    my ($val) = $self->SUPER::create(%$args);
+    warn "val is ".Jifty::YAML::Dump($val);
+    if ($self->id) {
+	    # XXX: when failed rollback the create?
+        warn "my id is ".$self->id;
         $self->init_repository;
     }
-    return ($id, $msg);
+    return ($val);
 }
 
 sub init_repository {
     my $self = shift;
-    $self->_svnadmin('create', $self->local_path);
-    $self->write_svnserv_config;
-    $self->write_httpd_config;
+
+    if ( -d $self->local_path ) {
+
+    } else {
+
+        $self->mkdir_parent( $self->local_path );
+        $self->_svnadmin( 'create', $self->local_path );
+        $self->write_svnserv_config;
+        $self->write_httpd_config;
+    }
+}
+
+sub mkdir_parent {
+    my $self = shift;
+    my $path = shift;
+    my @parts = File::Spec->splitdir($path);
+    pop @parts;
+    File::path::mkpath([File::Spec->catdir(@parts)]);
+
+
 }
 
 sub add_project {

Modified: commitbit/share/web/templates/admin/create_repository
==============================================================================
--- commitbit/share/web/templates/admin/create_repository	(original)
+++ commitbit/share/web/templates/admin/create_repository	Sat Sep 16 16:20:09 2006
@@ -9,5 +9,5 @@
 <% Jifty->web->form->end %>
 </&>
 <%init>
-my $create = Jifty->web->new_action(class => 'CreateRepository');
+my $create = Jifty->web->new_action(class => 'CreateRepository', moniker => 'newrepo');
 </%init>


More information about the Rt-commit mailing list