You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pgfqe6ch8/lib/tasks/shixun_giturl.rake

30 lines
757 B

6 years ago
namespace :giturl do
desc "sync giturl to shixun"
task :shixun => :environment do
g = Gitlab.client
shixuns = Shixun.where("gpid is not null")
shixuns.each do |shixun|
begin
git_url = g.project(shixun.gpid).path_with_namespace
shixun.update_column(:git_url, git_url)
puts shixun.id
rescue
puts "##{shixun.id}"
end
end
end
task :myshixun => :environment do
g = Gitlab.client
myshixuns = Myshixun.where("gpid is not null")
myshixuns.find_each do |myshixun|
begin
git_url = g.project(myshixun.gpid).path_with_namespace
myshixun.update_column(:git_url, git_url)
puts myshixun.id
rescue
puts myshixun.id
end
end
end
end