BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
2f7b6716
Commit
2f7b6716
authored
Dec 20, 2011
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:gitlabhq/gitlabhq
parents
3d4f524d
6793422e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
8 deletions
+30
-8
key.rb
app/models/key.rb
+2
-8
gitolite.rb
lib/gitlabhq/gitolite.rb
+28
-0
No files found.
app/models/key.rb
View file @
2f7b6716
...
...
@@ -21,20 +21,14 @@ class Key < ActiveRecord::Base
def
update_repository
Gitlabhq
::
GitHost
.
system
.
new
.
configure
do
|
c
|
c
.
update_keys
(
identifier
,
key
)
projects
.
each
do
|
project
|
c
.
update_project
(
project
.
path
,
project
)
end
c
.
update_projects
(
projects
)
end
end
def
repository_delete_key
Gitlabhq
::
GitHost
.
system
.
new
.
configure
do
|
c
|
c
.
delete_key
(
identifier
)
projects
.
each
do
|
project
|
c
.
update_project
(
project
.
path
,
project
)
end
c
.
update_projects
(
projects
)
end
end
...
...
lib/gitlabhq/gitolite.rb
View file @
2f7b6716
...
...
@@ -81,5 +81,33 @@ module Gitlabhq
ga_repo
.
save
end
# Updates many projects and uses project.path as the repo path
# An order of magnitude faster than update_project
def
update_projects
(
projects
)
ga_repo
=
::
Gitolite
::
GitoliteAdmin
.
new
(
File
.
join
(
@local_dir
,
'gitolite'
))
conf
=
ga_repo
.
config
projects
.
each
do
|
project
|
repo_name
=
project
.
path
repo
=
if
conf
.
has_repo?
(
repo_name
)
conf
.
get_repo
(
repo_name
)
else
::
Gitolite
::
Config
::
Repo
.
new
(
repo_name
)
end
name_readers
=
project
.
repository_readers
name_writers
=
project
.
repository_writers
repo
.
clean_permissions
repo
.
add_permission
(
"R"
,
""
,
name_readers
)
unless
name_readers
.
blank?
repo
.
add_permission
(
"RW+"
,
""
,
name_writers
)
unless
name_writers
.
blank?
conf
.
add_repo
(
repo
,
true
)
end
ga_repo
.
save
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment