From 631283ae79f5a15bb0da7741b97477a1a154458d Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 26 Aug 2015 20:37:43 +0800 Subject: [PATCH 01/41] remove grack --- app/controllers/repositories_controller.rb | 12 ++++++------ .../projects/settings/_new_repositories.html.erb | 15 +++++++++++++++ config/routes.rb | 2 +- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 6dec9a82f..126b269bb 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -127,18 +127,19 @@ update end else # 原逻辑 ##xianbo - params[:repository_scm] = "Git" @root_path=RepositoriesHelper::ROOT_PATH @repository_name=User.current.login.to_s+"/"+params[:repository][:identifier]+".git" @project_path=@root_path+"htdocs/"+@repository_name - @repository_tag=params[:repository][:upassword] || params[:repository][:password] || '1234' + @repository_tag=params[:repository][:upassword] || params[:repository][:password] @repo_name=User.current.login.to_s+"_"+params[:repository][:identifier] logger.info "htpasswd -mb "+@root_path+"htdocs/user.passwd "+@repo_name+": "+@repository_tag logger.info "the value of create repository"+@root_path+": "+@repository_name+": "+@project_path+": "+@repo_name attrs = pickup_extra_info - params[:repository][:url]=@project_path + if((@repository_tag!="")&¶ms[:repository_scm]=="Git") + params[:repository][:url]=@project_path + end ###xianbo - @repository = Repository.factory(params[:repository_scm]||"Git") + @repository = Repository.factory(params[:repository_scm]) @repository.safe_attributes = params[:repository] if attrs[:attrs_extra].keys.any? @repository.merge_extra_info(attrs[:attrs_extra]) @@ -277,8 +278,7 @@ update @course_tag = params[:course] project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT ip = RepositoriesHelper::REPO_IP_ADDRESS - # @repos_url = "http://"+@repository.login.to_s+"_"+@repository.identifier.to_s+"@"+ip.to_s+ - @repos_url = "http://#{Setting.host_name}/#{@repository.login.to_s}/#{@repository.identifier.to_s}.git" + @repos_url = "http://"+@repository.login.to_s+"_"+@repository.identifier.to_s+"@"+ip.to_s+ @repository.url.slice(project_path_cut, @repository.url.length).to_s if @course_tag == 1 render :action => 'show', :layout => 'base_courses' diff --git a/app/views/projects/settings/_new_repositories.html.erb b/app/views/projects/settings/_new_repositories.html.erb index b626b4089..be793a409 100644 --- a/app/views/projects/settings/_new_repositories.html.erb +++ b/app/views/projects/settings/_new_repositories.html.erb @@ -62,6 +62,16 @@ <%= labelled_form_for :repository, @repository, :url =>project_repositories_path(@project),:html => {:id => 'repository-form',:method=>"post"} do |f| %>