[Rt-commit] r5903 - in commitbit: . lib/CommitBit
jesse at bestpractical.com
jesse at bestpractical.com
Mon Sep 11 10:54:02 EDT 2006
Author: jesse
Date: Mon Sep 11 10:54:02 2006
New Revision: 5903
Added:
commitbit/lib/CommitBit/Record.pm
Modified:
commitbit/ (props changed)
commitbit/lib/CommitBit/Model/Repository.pm
Log:
r27363 at 113: jesse | 2006-09-11 15:53:56 +0100
* added autogen of more stuff
Modified: commitbit/lib/CommitBit/Model/Repository.pm
==============================================================================
--- commitbit/lib/CommitBit/Model/Repository.pm (original)
+++ commitbit/lib/CommitBit/Model/Repository.pm Mon Sep 11 10:54:02 2006
@@ -40,7 +40,7 @@
my $members = $users->join(
alias1 => 'main',
column1 => 'id',
- table2 => 'projectmembers',
+ table2 => 'project_members',
column2 => 'user'
);
my $projects = $users->join(
@@ -101,13 +101,14 @@
# XXX: when failed rollback the create?
$self->init_repository;
}
-
return ($id, $msg);
}
sub init_repository {
my $self = shift;
$self->_svnadmin('create', $self->path);
+ $self->write_svnserv_config;
+ $self->write_httpd_config;
}
sub add_project {
@@ -132,12 +133,26 @@
sub write_htpasswd_file {
my $self = shift;
with_write_lock {
+ open my $fh, '>', $self->svnconf_file_path('htpasswd') or die $@;
+ print $fh $self->autogenerated_file_warning;
+ my $users = $self->associated_users;
+ while (my $user = $users->next) {
+ print $fh `htpasswd -nmsb @{[$user->name]} @{[$user->password]}`;
+ }
};
}
sub write_svnserve_passwd_file {
my $self = shift;
with_write_lock {
+ open my $fh, '>', $self->svnconf_file_path('passwd') or die $@;
+ print $fh $self->autogenerated_file_warning;
+ print $fh "[users]\n";
+ my $users = $self->associated_users;
+ while (my $user = $users->next) {
+ print $fh $user->name. ' = '. $user->password. "\n";
+ }
+
# all users that involves in any project in the repository
};
}
Added: commitbit/lib/CommitBit/Record.pm
==============================================================================
--- (empty file)
+++ commitbit/lib/CommitBit/Record.pm Mon Sep 11 10:54:02 2006
@@ -0,0 +1,37 @@
+package CommitBit::Record;
+use base 'Jifty::Record';
+use strict;
+use warnings;
+
+
+sub after_create {
+ my $self = shift;
+ $self->update_all_repositories;
+ return 1;
+}
+
+sub _set {
+ my $self = shift;
+ my @ret = $self->SUPER::_set(@_);
+
+ $self->update_all_repositories;
+
+ return @ret;
+}
+
+
+sub update_all_repositories {
+ my $self = shift;
+
+ my $repositories = CommitBit::Model::RepositoryCollection->new;
+ $repositories->unlimit;
+
+ while (my $repository = $repositories->next) {
+ $repository->write_password_files;
+ $repository->write_authz_file();
+ }
+}
+
+
+1;
+
More information about the Rt-commit
mailing list