Commit ba8420bdb7f2a99f0ec9465204172cedcbd7c91f:
fix weakref regression
introduced:
https://github.com/apache/whimsy/commit/7e797e5590c7da8294a046e6f51c9604ea65f03c
reported:
https://issues.apache.org/jira/browse/WHIMSY-34?focusedCommentId=15094958&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15094958
Branch: refs/heads/master
Author: Sam Ruby <[email protected]>
Committer: Sam Ruby <[email protected]>
Pusher: rubys <[email protected]>
------------------------------------------------------------
asf.version | + -
lib/whimsy/asf/committee.rb | ++++++++++ -----
lib/whimsy/asf/ldap.rb | ++++++ --
lib/whimsy/asf/mail.rb | ++ --
------------------------------------------------------------
29 changes: 19 additions, 10 deletions.
------------------------------------------------------------
diff --git a/asf.version b/asf.version
index 2225cdf..30eb585 100644
--- a/asf.version
+++ b/asf.version
@@ -1 +1 @@
-0.0.73
+0.0.74
diff --git a/lib/whimsy/asf/committee.rb b/lib/whimsy/asf/committee.rb
index 2f30837..3cafd86 100644
--- a/lib/whimsy/asf/committee.rb
+++ b/lib/whimsy/asf/committee.rb
@@ -48,9 +48,13 @@ def self.load_committee_info
board = ASF::SVN['private/committers/board']
file = "#{board}/committee-info.txt"
return unless File.exist? file
+
+ list = Hash.new {|hash, name| hash[name] = find(name)}
+
if @committee_info and File.mtime(file) == @committee_mtime
return @committee_info
end
+
@committee_mtime = File.mtime(file)
@@svn_change = Time.parse(
`svn info #{file}`[/Last Changed Date: (.*) \(/, 1]).gmtime
@@ -62,15 +66,16 @@ def self.load_committee_info
# extract the committee chairs (e-mail address is required here)
head.scan(/^[ \t]+(\w.*?)[ \t][ \t]+(.*)[ \t]+<(.*?)@apache\.org>/).
each do |committee, name, id|
- find(committee).chairs << {name: name, id: id}
+ list[committee].chairs << {name: name, id: id}
end
+
# Extract the non-PMC committees (e-mail address may be absent)
@nonpmcs = head.sub(/.*?also has/m,'').
scan(/^[ \t]+(\w.*?)(?:[ \t][ \t]|[ \t]?$)/).flatten.uniq.
- map {|name| find(name)}
+ map {|name| list[name]}
info.each do |roster|
- committee = find(@@namemap.call(roster[/(\w.*?)\s+\(/,1]))
+ committee = list[@@namemap.call(roster[/(\w.*?)\s+\(/,1])]
committee.established = roster[/\(est\. (.*?)\)/, 1]
roster.gsub! /^.*\(\s*emeritus\s*\).*/i do |line|
committee.emeritus += line.scan(/<(.*?)@apache\.org>/).flatten
@@ -85,7 +90,7 @@ def self.load_committee_info
report.scan(/^([^\n]+)\n---+\n(.*?)\n\n/m).each do |period, committees|
committees.scan(/^ \s*(.*)/).each do |committee|
committee, comment = committee.first.split(/\s+#\s+/,2)
- committee = find(committee)
+ committee = list[committee]
if comment
committee.report = "#{period}: #{comment}"
elsif period == 'Next month'
@@ -96,7 +101,7 @@ def self.load_committee_info
end
end
- @committee_info = ASF::Committee.collection.values
+ @committee_info = list.values
end
def self.nonpmcs
diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index 8e46d77..98b8242 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -172,6 +172,8 @@ def self.list(filter='uid=*')
# pre-fetch a given attribute, for a given list of people
def self.preload(attributes, people={})
+ list = Hash.new {|hash, name| hash[name] = find(name)}
+
attributes = [attributes].flatten
if people.empty?
@@ -183,14 +185,16 @@ def self.preload(attributes, people={})
zero = Hash[attributes.map {|attribute| [attribute,nil]}]
data = ASF.search_one(base, filter, attributes + ['uid'])
- data = Hash[data.map! {|hash| [find(hash['uid'].first), hash]}]
+ data = Hash[data.map! {|hash| [list[hash['uid'].first], hash]}]
data.each {|person, hash| person.attrs.merge!(zero.merge(hash))}
if people.empty?
- (collection.values - data.keys).each do |person|
+ (list.values - data.keys).each do |person|
person.attrs.merge! zero
end
end
+
+ list.values
end
def attrs
diff --git a/lib/whimsy/asf/mail.rb b/lib/whimsy/asf/mail.rb
index fc69a6d..bbc1cf0 100644
--- a/lib/whimsy/asf/mail.rb
+++ b/lib/whimsy/asf/mail.rb
@@ -8,8 +8,8 @@ def self.list
list = Hash.new
# load info from LDAP
- ASF::Person.preload(['mail', 'asf-altEmail'])
- ASF::Person.collection.each do |name, person|
+ people = ASF::Person.preload(['mail', 'asf-altEmail'])
+ people.each do |name, person|
(person.mail+person.alt_email).each do |mail|
list[mail.downcase] = person
end