Use similar interface to access gitolite
Simplified gitolite handle logic Stubn over monkeypatch Stub only specific methods in Gitlab:Gitolite Moved grach auth to lib added specs for keys observer removes SshKey role
This commit is contained in:
parent
aded7056fd
commit
7cdc5b9e04
20 changed files with 155 additions and 88 deletions
5
app/roles/git_host.rb
Normal file
5
app/roles/git_host.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
module GitHost
|
||||
def git_host
|
||||
Gitlab::Gitolite.new
|
||||
end
|
||||
end
|
|
@ -1,2 +0,0 @@
|
|||
module GitMerge
|
||||
end
|
|
@ -1,4 +1,6 @@
|
|||
module Repository
|
||||
include GitHost
|
||||
|
||||
def valid_repo?
|
||||
repo
|
||||
rescue
|
||||
|
@ -48,7 +50,7 @@ module Repository
|
|||
end
|
||||
|
||||
def url_to_repo
|
||||
Gitlab::GitHost.url_to_repo(path)
|
||||
git_host.url_to_repo(path)
|
||||
end
|
||||
|
||||
def path_to_repo
|
||||
|
@ -56,11 +58,11 @@ module Repository
|
|||
end
|
||||
|
||||
def update_repository
|
||||
Gitlab::GitHost.system.update_project(path, self)
|
||||
git_host.update_repository(self)
|
||||
end
|
||||
|
||||
def destroy_repository
|
||||
Gitlab::GitHost.system.destroy_project(self)
|
||||
git_host.remove_repository(self)
|
||||
end
|
||||
|
||||
def repo_exists?
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
module SshKey
|
||||
def update_repository
|
||||
Gitlab::GitHost.system.new.configure do |c|
|
||||
c.update_keys(identifier, key)
|
||||
c.update_projects(projects)
|
||||
end
|
||||
end
|
||||
|
||||
def repository_delete_key
|
||||
Gitlab::GitHost.system.new.configure do |c|
|
||||
#delete key file is there is no identically deploy keys
|
||||
if !is_deploy_key || Key.where(identifier: identifier).count() == 0
|
||||
c.delete_key(identifier)
|
||||
end
|
||||
c.update_projects(projects)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue