[Xfce4-commits] <moka:master> Make gitolite script work with groups.
Nick Schermer
noreply at xfce.org
Sun Nov 20 20:26:02 CET 2011
Updating branch refs/heads/master
to 8e5f6db2ea47f8c98805924defd6f158865cc9c4 (commit)
from a84fb0f27cc24d61767a8719fe35df6b7fb77e63 (commit)
commit 8e5f6db2ea47f8c98805924defd6f158865cc9c4
Author: Nick Schermer <nick at xfce.org>
Date: Sun Nov 20 20:25:06 2011 +0100
Make gitolite script work with groups.
lib/helpers/gitolite.rb | 31 ++++++++++++++++++++++---------
1 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/lib/helpers/gitolite.rb b/lib/helpers/gitolite.rb
index 41e9017..e100008 100644
--- a/lib/helpers/gitolite.rb
+++ b/lib/helpers/gitolite.rb
@@ -20,13 +20,14 @@ module Moka
if pubkeys(keydir, maintainer)
# store the projects this maintainer handles
for project in maintainer.projects
- projects[project.name] = Array.new if not projects[project.name]
+ projects[project.name] = Array.new if projects[project.name].nil?
projects[project.name] << maintainer.username
end
end
end
- conf = "# This file is generated by Moka\n\n"
+ conf = "# This file is generated by Moka at\n" +
+ "# " + Time.now.to_s + "\n\n"
if prepend_files
for filename in prepend_files
@@ -36,16 +37,28 @@ module Moka
end
end
+ public = Moka::Models::Group.get('public')
+ repo = Moka::Models::Group.get('repo')
+
for classification in Moka::Models::Classification.find_all.sort
- for project in classification.project_names.sort
- conf << "repo " + classification.name + "/" + project + "\n"
+ for name in classification.project_names.sort
+ project = Moka::Models::Project.get(name)
+ next if project.nil? or not name.eql? project.name
+
+ # skip non-git projects
+ next unless project.groups.include?(repo)
+
+ # basic permissions
+ conf << "repo " + classification.name + "/" + name + "\n"
conf << "\tRW = @repo-admin"
- maintainers = projects[project]
- if maintainers
- conf << "\n\tRW ="
- maintainers.sort.each { |name| conf << " " + name }
- end
+ # add maintainers
+ maintainers = projects[name]
+ conf << "\n\tRW = " + maintainers.sort.join(" ") if maintainers
+
+ # let gitolite create git-daemon-export-ok
+ conf << "\n\tR = daemon" if project.groups.include?(public)
+
conf << "\n\n"
end
end
More information about the Xfce4-commits
mailing list