gitlab-org--gitlab-foss/lib/gitlab/backend/gitolite.rb

65 lines
1.4 KiB
Ruby
Raw Normal View History

require_relative 'gitolite_config'
2011-12-03 18:44:59 -05:00
module Gitlab
2011-12-03 18:44:59 -05:00
class Gitolite
class AccessDenied < StandardError; end
def config
Gitlab::GitoliteConfig.new
end
2011-12-03 18:44:59 -05:00
def set_key key_id, key_content, projects
config.apply do |config|
config.write_key(key_id, key_content)
config.update_projects(projects)
end
end
def remove_key key_id, projects
config.apply do |config|
config.rm_key(key_id)
config.update_projects(projects)
end
end
def update_repository project_id
project = Project.find(project_id)
config.update_project!(project)
2012-03-05 17:26:40 -05:00
end
2012-11-27 09:35:00 -05:00
def move_repository(old_repo, project)
config.apply do |config|
config.clean_repo(old_repo)
2012-11-27 09:35:00 -05:00
config.update_project(project)
end
end
# Remove repository from gitolite
#
# name - project path with namespace
#
# Ex.
# remove_repository("gitlab/gitlab-ci")
#
def remove_repository(name)
config.destroy_project!(name)
2012-03-05 17:26:40 -05:00
end
def url_to_repo path
Gitlab.config.gitolite.ssh_path_prefix + "#{path}.git"
end
def enable_automerge
config.admin_all_repo!
end
def update_repositories projects
config.apply do |config|
config.update_projects(projects)
end
end
alias_method :create_repository, :update_repository
2011-12-03 18:44:59 -05:00
end
end