Merge branch 'gitlab_guange' into szzh

This commit is contained in:
huang 2015-11-04 16:41:02 +08:00
commit 0bcb4007ce
4 changed files with 25 additions and 2 deletions

View File

@ -49,7 +49,7 @@
<% end %>
<a class="subnav_num">(<%= @project.repositories.count %>)</a>
<% if (User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project)) && rep_is_gitlab?(@project) %>
<%= link_to "+"+l(:project_module_create_repository), url_for(:controller => 'projects', :action => 'settings', :id => @project.id, :tab=>'repositories') , :class => "subnav_green" %>
<%= link_to "+"+l(:project_gitlab_create_repository), url_for(:controller => 'projects', :action => 'settings', :id => @project.id, :tab=>'repositories') , :class => "subnav_green" %>
<% end %>
</div>
<% end %>

View File

@ -0,0 +1,22 @@
#coding=utf-8
namespace :sync_rep do
desc "sync some projects which just have sigle repository"
task :sigle => :environment do
projects = Project.all
projects.each do |project|
# 针对类型为Git并且只有一个版本库的项目
if project.repositories && project.repositories.count == 1 && project.repositories.first.type == "Repository::Git"
rep = project.repositories.first
s = Trustie::Gitlab::Sync.new
s.sync_project(project, path: rep.identifier, import_url: rep.url)
rep.type = 'Repository::Gitlab'
rep.save
puts "*************************************"
puts project.id
puts rep.id
puts rep.identifier
end
end
end
end

View File

@ -66,7 +66,7 @@ module Trustie
if opt[:password]
import_url.sub('@', ":#{opt[:password]}@")
end
# import url http://xianbo_trustie2:1234@repository.trustie.net/xianbo/trustie2.git
# can use password
gproject = self.g.create_project(path,
@ -76,6 +76,7 @@ module Trustie
wall_enabled: false,
issues_enabled: false,
snippets_enabled: false,
merge_requests_enabled: true,
public: false,
user_id: gid,
import_url: import_url