comparison extra/soundsoftware/create-repo-authormaps.rb @ 1539:22d57b0e0a77 live

OK, this script works now, but it should be using the API
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 21 May 2015 17:31:06 +0100
parents 87bea4981d6d
children 322d7b57e5f0
comparison
equal deleted inserted replaced
1538:87bea4981d6d 1539:22d57b0e0a77
71 71
72 projects.each do |proj| 72 projects.each do |proj|
73 next unless proj.respond_to?(:repository) 73 next unless proj.respond_to?(:repository)
74 74
75 repo = proj.repository 75 repo = proj.repository
76 next if repo.nil? or repo.url.empty?
76 77
77 repo_url = repo.url 78 repo_url = repo.url
78 repo_url = repo_url.gsub(/^file:\/*/, "/"); 79 repo_url = repo_url.gsub(/^file:\/*/, "/");
79 if repo_url != File.join($repos_base, proj.identifier) 80 if repo_url != File.join($repos_base, proj.identifier)
80 log('Project #{proj.identifier} has repo in unsupported location #{repo_url}, skipping') 81 log('Project #{proj.identifier} has repo in unsupported location #{repo_url}, skipping')
86 87
87 authormap = "" 88 authormap = ""
88 committers.each do |c| 89 committers.each do |c|
89 if not c =~ /[^<]+<.*@.*>/ then 90 if not c =~ /[^<]+<.*@.*>/ then
90 user = repo.find_committer_user c 91 user = repo.find_committer_user c
91 authormap << "#{c}=#{u.name} <#{u.mail}>\n" unless u.nil? 92 authormap << "#{c}=#{user.name} <#{user.mail}>\n" unless user.nil?
92 end 93 end
93 end 94 end
94 95
95 File.open (File.join($out_base, "authormap_#{proj.identifier}"), "w") do |f| 96 File.open(File.join($out_base, "authormap_#{proj.identifier}"), "w") do |f|
96 f.puts(authormap) 97 f.puts(authormap)
97 end 98 end
98 99
99 end 100 end
100 101