gitolite & gitosis support
This commit is contained in:
parent
c03bc6e291
commit
9e089efe5a
14 changed files with 200 additions and 98 deletions
|
@ -3,7 +3,7 @@ class ApplicationController < ActionController::Base
|
|||
protect_from_forgery
|
||||
helper_method :abilities, :can?
|
||||
|
||||
rescue_from Gitosis::AccessDenied do |exception|
|
||||
rescue_from Gitlabhq::Gitosis::AccessDenied, Gitlabhq::Gitolite::AccessDenied do |exception|
|
||||
render :file => File.join(Rails.root, "public", "gitosis_error"), :layout => false
|
||||
end
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class ProjectsController < ApplicationController
|
|||
format.js
|
||||
end
|
||||
end
|
||||
rescue Gitosis::AccessDenied
|
||||
rescue Gitlabhq::Gitosis::AccessDenied, Gitlabhq::Gitolite::AccessDenied
|
||||
render :js => "location.href = '#{errors_gitosis_path}'" and return
|
||||
rescue StandardError => ex
|
||||
@project.errors.add(:base, "Cant save project. Please try again later")
|
||||
|
|
|
@ -19,7 +19,7 @@ class Key < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def update_gitosis
|
||||
Gitosis.new.configure do |c|
|
||||
GitoProxy.system.new.configure do |c|
|
||||
c.update_keys(identifier, key)
|
||||
|
||||
projects.each do |project|
|
||||
|
@ -29,7 +29,7 @@ class Key < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def gitosis_delete_key
|
||||
Gitosis.new.configure do |c|
|
||||
GitoProxy.system.new.configure do |c|
|
||||
c.delete_key(identifier)
|
||||
|
||||
projects.each do |project|
|
||||
|
|
|
@ -22,25 +22,25 @@ class Repository
|
|||
end
|
||||
|
||||
def url_to_repo
|
||||
if !GITOSIS["port"] or GITOSIS["port"] == 22
|
||||
"#{GITOSIS["git_user"]}@#{GITOSIS["host"]}:#{path}.git"
|
||||
if !GIT_HOST["port"] or GIT_HOST["port"] == 22
|
||||
"#{GIT_HOST["git_user"]}@#{GIT_HOST["host"]}:#{path}.git"
|
||||
else
|
||||
"ssh://#{GITOSIS["git_user"]}@#{GITOSIS["host"]}:#{GITOSIS["port"]}/#{path}.git"
|
||||
"ssh://#{GIT_HOST["git_user"]}@#{GIT_HOST["host"]}:#{GIT_HOST["port"]}/#{path}.git"
|
||||
end
|
||||
end
|
||||
|
||||
def path_to_repo
|
||||
GITOSIS["base_path"] + path + ".git"
|
||||
GIT_HOST["base_path"] + path + ".git"
|
||||
end
|
||||
|
||||
def update_gitosis_project
|
||||
Gitosis.new.configure do |c|
|
||||
GitProxy.system.new.configure do |c|
|
||||
c.update_project(path, project.gitosis_writers)
|
||||
end
|
||||
end
|
||||
|
||||
def destroy_gitosis_project
|
||||
Gitosis.new.configure do |c|
|
||||
GitProxy.system.new.configure do |c|
|
||||
c.destroy_project(@project)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
%tr
|
||||
%td
|
||||
.left= f.label :path
|
||||
%cite.right= "git@#{GITOSIS["host"]}:"
|
||||
%cite.right= "git@#{GIT_HOST["host"]}:"
|
||||
%td
|
||||
= f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record?
|
||||
%tr
|
||||
%td
|
||||
.left= f.label :code
|
||||
%cite.right= "http://#{GITOSIS["host"]}/"
|
||||
%cite.right= "http://#{GIT_HOST["host"]}/"
|
||||
%td= f.text_field :code, :placeholder => "example"
|
||||
|
||||
%tr
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue