Class: ASF::Committee

Inherits:
Base
  • Object
show all
Defined in:
lib/whimsy/asf/ldap.rb,
lib/whimsy/asf/mail.rb,
lib/whimsy/asf/committee.rb

Constant Summary collapse

@@aliases =

mapping of committee names to canonical names (generally from ldap) See also www/roster/committee.cgi

Hash.new {|hash, name| name}
@@namemap =
Proc.new do |name|
  cname = @@aliases[name.downcase]
  cname
end

Instance Attribute Summary collapse

Attributes inherited from Base

#name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

[], #base, base, collection, #id, new

Constructor Details

#initialize(*args) ⇒ Committee

Returns a new instance of Committee.



8
9
10
11
12
# File 'lib/whimsy/asf/committee.rb', line 8

def initialize(*args)
  @info = []
  @emeritus = []
  super
end

Instance Attribute Details

#emeritus ⇒ Object

Returns the value of attribute emeritus.



7
8
9
# File 'lib/whimsy/asf/committee.rb', line 7

def emeritus
  @emeritus
end

#info ⇒ Object

Returns the value of attribute info.



7
8
9
# File 'lib/whimsy/asf/committee.rb', line 7

def info
  @info
end

#names ⇒ Object

Returns the value of attribute names.



7
8
9
# File 'lib/whimsy/asf/committee.rb', line 7

def names
  @names
end

#report ⇒ Object

Returns the value of attribute report.



7
8
9
# File 'lib/whimsy/asf/committee.rb', line 7

def report
  @report
end

Class Method Details

.find(name) ⇒ Object



88
89
90
91
92
# File 'lib/whimsy/asf/committee.rb', line 88

def self.find(name)
  result = super(@@aliases[name.downcase])
  result.display_name = name if name =~ /[A-Z]/
  result
end

.list(filter = 'cn=*') ⇒ Object



210
211
212
# File 'lib/whimsy/asf/ldap.rb', line 210

def self.list(filter='cn=*')
  ASF.search_one(base, filter, 'cn').flatten.map {|cn| Committee.find(cn)}
end

.load_committee_info ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/whimsy/asf/committee.rb', line 39

def self.load_committee_info
  board = ASF::SVN['private/committers/board']
  file = "#{board}/committee-info.txt"
  if @committee_info and File.mtime(file) == @committee_mtime
    return @committee_info 
  end
  @committee_mtime = File.mtime(file)

  info = File.read(file).split(/^\* /)
  head, report = info.shift.split(/^\d\./)[1..2]
  head.scan(/^\s+(\w.*?)\s\s+.*<(\w+)@apache\.org>/).each do |name, id|
    find(name).chair = ASF::Person.find(id) 
  end
  @nonpmcs = head.sub(/.*?also has/m,'').
    scan(/^\s+(\w.*?)\s\s+.*<\w+@apache\.org>/).flatten.uniq.
    map {|name| find(name)}

  info.each do |roster|
    committee = find(@@namemap.call(roster[/(\w.*?)\s+\(/,1]))
    roster.gsub! /^.*\(\s*emeritus\s*\).*/i do |line|
      committee.emeritus += line.scan(/<(.*?)@apache\.org>/).flatten
      ''
    end
    committee.info = roster.scan(/<(.*?)@apache\.org>/).flatten
    committee.names = Hash[roster.gsub(/\(\w+\)/, '').
      scan(/^\s*(.*?)\s*<(.*?)@apache\.org>/).map {|list| list.reverse}]
  end

  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)
      if comment
        committee.report = "#{period}: #{comment}"
      elsif period == 'Next month'
        committee.report = 'Every month'
      else
        committee.report = period
      end
    end
  end

  @committee_info = ASF::Committee.collection.values
end

.nonpmcs ⇒ Object



84
85
86
# File 'lib/whimsy/asf/committee.rb', line 84

def self.nonpmcs
  @nonpmcs
end

Instance Method Details

#chair ⇒ Object



94
95
96
97
# File 'lib/whimsy/asf/committee.rb', line 94

def chair
  Committee.load_committee_info
  @chair
end

#chair=(person) ⇒ Object



108
109
110
# File 'lib/whimsy/asf/committee.rb', line 108

def chair=(person)
  @chair = person
end

#display_name ⇒ Object



99
100
101
102
# File 'lib/whimsy/asf/committee.rb', line 99

def display_name
  Committee.load_committee_info
  @display_name || name
end

#display_name=(name) ⇒ Object



104
105
106
# File 'lib/whimsy/asf/committee.rb', line 104

def display_name=(name)
  @display_name ||= name
end

#mail_list ⇒ Object



76
77
78
79
# File 'lib/whimsy/asf/mail.rb', line 76

def mail_list
  return 'hc' if name == 'httpcomponents'
  name
end

#members ⇒ Object



214
215
216
217
# File 'lib/whimsy/asf/ldap.rb', line 214

def members
  ASF.search_one(base, "cn=#{name}", 'member').flatten.
    map {|uid| Person.find uid[/uid=(.*?),/,1]}
end

#nonpmc? ⇒ Boolean

Returns:

  • (Boolean)


120
121
122
# File 'lib/whimsy/asf/committee.rb', line 120

def nonpmc?
  Committee.nonpmcs.include? self
end