|
|
|
@ -35,6 +35,8 @@ class RepositoriesController < ApplicationController
|
|
|
|
|
before_filter :find_project_repository, :except => [:new, :create, :newcreate, :edit, :update, :destroy, :committers, :newrepo, :to_gitlab, :forked, :project_archive]
|
|
|
|
|
before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue]
|
|
|
|
|
before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :commit_diff, :project_archive, :quality_analyses]
|
|
|
|
|
# 链接gitlab
|
|
|
|
|
before_filter :connect_gitlab, :only => [:quality_analyses]
|
|
|
|
|
accept_rss_auth :revisions
|
|
|
|
|
# hidden repositories filter // 隐藏代码过滤器
|
|
|
|
|
before_filter :check_hidden_repo, :only => [:show, :stats, :revisions, :revision, :diff ]
|
|
|
|
@ -308,26 +310,30 @@ update
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def quality_analyses
|
|
|
|
|
language = params[:language]
|
|
|
|
|
branch = params[:branch]
|
|
|
|
|
path = params[:path]
|
|
|
|
|
user_name = User.find(@project.user_id).try(:login)
|
|
|
|
|
rep_name = params[:repository_id]
|
|
|
|
|
host = "192.168.0.200"
|
|
|
|
|
port = "1125"
|
|
|
|
|
username = "git"
|
|
|
|
|
password = "123123"
|
|
|
|
|
server_cmd1 = "sh gitclone.sh" + " " + user_name + " " + rep_name
|
|
|
|
|
# 连接到远程主机 foobar
|
|
|
|
|
ssh = Net::SSH.start(host, username, :port => port, :password => password) do |ssh|
|
|
|
|
|
result = ssh.exec!(server_cmd1)
|
|
|
|
|
path = "/home/git/repo/" + user_name + "/" + rep_name
|
|
|
|
|
# sonar 分析
|
|
|
|
|
# server_cmd2
|
|
|
|
|
# 删除clone的版本库
|
|
|
|
|
# server_cmd3
|
|
|
|
|
end
|
|
|
|
|
gitlab_branches = @g.branches(@project.gpid)
|
|
|
|
|
@branch_names = gitlab_branches.map{|b| b.name}
|
|
|
|
|
@gitlab_default_branch = @g.project(@project.gpid).default_branch
|
|
|
|
|
# language = params[:language]
|
|
|
|
|
# branch = params[:branch]
|
|
|
|
|
# path = params[:path]
|
|
|
|
|
# user_name = User.find(@project.user_id).try(:login)
|
|
|
|
|
# rep_name = params[:repository_id]
|
|
|
|
|
# host = "192.168.0.200"
|
|
|
|
|
# port = "1125"
|
|
|
|
|
# username = "git"
|
|
|
|
|
# password = "123123"
|
|
|
|
|
# server_cmd1 = "sh gitclone.sh" + " " + user_name + " " + rep_name
|
|
|
|
|
# # 连接到远程主机 foobar
|
|
|
|
|
# ssh = Net::SSH.start(host, username, :port => port, :password => password) do |ssh|
|
|
|
|
|
# result = ssh.exec!(server_cmd1)
|
|
|
|
|
# path = "/home/git/repo/" + user_name + "/" + rep_name
|
|
|
|
|
# # sonar 分析
|
|
|
|
|
# # server_cmd2
|
|
|
|
|
# # 删除clone的版本库
|
|
|
|
|
# # server_cmd3
|
|
|
|
|
# end
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.js
|
|
|
|
|
format.html{
|
|
|
|
|
render :layout => "base_projects"
|
|
|
|
|
}
|
|
|
|
@ -643,6 +649,14 @@ update
|
|
|
|
|
project.project_score.update_attribute(:commit_time, date.created_at)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 链接gitlab
|
|
|
|
|
def connect_gitlab
|
|
|
|
|
@g = Gitlab.client
|
|
|
|
|
unless @project.gpid.nil?
|
|
|
|
|
@g_project = @g.project(@project.gpid)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def find_repository
|
|
|
|
|
@repository = Repository.find(params[:id])
|
|
|
|
|
@project = @repository.project
|
|
|
|
|