diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index a2167bdf9..87b75891e 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -76,6 +76,8 @@ class RepositoriesController < ApplicationController @repository_name=User.current.login.to_s+"/"+params[:repository][:identifier]+".git" @project_path=@root_path+"htdocs/"+@repository_name @repository_tag=params[:repository][:upassword] + @repo_name=User.current.login.to_s+"-"+params[:repository][:identifier] + @middle=User.current.login.to_s+"-"+params[:repository][:identifier]+"-write:" attrs = pickup_extra_info if((@repository_tag!="")&¶ms[:repository_scm]=="Git") params[:repository][:url]=@project_path @@ -91,23 +93,19 @@ class RepositoriesController < ApplicationController @repository.project = @project if request.post? && @repository.save if(params[:repository_scm]=="Git") - system "htpasswd -mb "+@root_path+"user.passwd "+User.current.login.to_s+" "+@repository_tag - system "echo -e '\n"+User.current.login.to_s+"-"+params[:repository][:identifier]+"-write:"+ - " "+User.current.login.to_s+"' >> "+@root_path+"group.passwd" + system "htpasswd -mb "+@root_path+" "+@repo_name+" "+@repository_tag + system "echo -e '\n"+@repo_name+"-write:"+ + " "+@repo_name+"' >> "+@root_path+"group.passwd" system "mkdir "+@root_path+"htdocs/"+User.current.login.to_s system "git init --bare "+@project_path system "mv "+@project_path+"/hooks/post-update{.sample,}" system "chmod a+x "+@project_path+"/hooks/post-update" system "echo -e 'Allow from all \n Order Deny,Allow \n "+ " \n"+ - "Require group "+User.current.login.to_s+"-"+params[:repository][:identifier]+"-write \n "+ + "Require group "+@repo_name+"-write \n "+ " \n ' >> "+ - @root_path+"htdocs/"+ @repository_name+"/.htaccess" - - puts "before ======================================================================" - puts system "cd "+@project_path+" ;git update-server-info" - flag = system "cd "+@project_path+" ;git update-server-info" - puts "after flag:#{flag} ======================================================================" + @root_path+"htdocs/"+ @repository_name+"/.htaccess" + flag = system "cd "+@project_path+" ;git update-server-info" @repository.update_attributes(:login => User.current.login.to_s) end redirect_to settings_project_path(@project, :tab => 'repositories') @@ -170,11 +168,10 @@ class RepositoriesController < ApplicationController @repository_name=User.current.login.to_s+"/"+@repository.identifier.to_s+".git" @repository.destroy if request.delete? redirect_to settings_project_path(@project, :tab => 'repositories') - if(@repository.type=="Repository::Git") - puts "before destroy system cmd =======================================" - puts "rm -r "+@root_path+@repository_name - flag = system "rm -r "+@root_path+"htdocs/"+@repository_name - puts "after destroy system cmd :#{flag} =======================================" + if(@repository.type=="Repository::Git") + system "sed -i /"+@repo_name+"/{d} "+@root_path+"user.passwd" + system "sed -i /"+@middle+"/{d} "+@root_path+"group.passwd" + system "rm -r "+@root_path+"htdocs/"+@repository_name end end diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 7c4100732..96ae7562d 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1261,9 +1261,11 @@ zh: label_tags_user_mail: 用户邮箱: label_tags_numbers: Tag统计: label_max_number: 至多25个字符。 + label_mail_attention: qq邮箱可能收不到此邮件,其他邮箱如果没有收到可能在垃圾邮件中 label_all_revisions: 所有版本: label_upassword_info: 该密码在项目组内可共享 label_how_commit_code: 如何提交代码: label_how_commit_code_chinese: 中文 label_welcome_leave_message: 朋友,系统仍在不断完善,有意见和建议请 label_welcome_click_me: 点击我 + label_mail_attention: qq邮箱可能收不到此邮件,其他邮箱如果没有收到可能在垃圾邮件中