Class: ASF::Committee

Inherits:
Base
  • Object
show all
Defined in:
lib/whimsy/asf/ldap.rb,
lib/whimsy/asf/mail.rb,
lib/whimsy/asf/site.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.sub(/\s+\(.*?\)/, '').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, #reference

Constructor Details

#initialize(*args) ⇒ Committee

Returns a new instance of Committee.



11
12
13
14
15
16
17
# File 'lib/whimsy/asf/committee.rb', line 11

def initialize(*args)
  @info = []
  @emeritus = []
  @chairs = []
  @roster = {}
  super
end

Instance Attribute Details

#chairsObject

Returns the value of attribute chairs.



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

def chairs
  @chairs
end

#emeritusObject

Returns the value of attribute emeritus.



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

def emeritus
  @emeritus
end

#establishedObject

Returns the value of attribute established.



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

def established
  @established
end

#infoObject

Returns the value of attribute info.



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

def info
  @info
end

#reportObject

Returns the value of attribute report.



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

def report
  @report
end

#rosterObject

Returns the value of attribute roster.



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

def roster
  @roster
end

#scheduleObject

Returns the value of attribute schedule.



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

def schedule
  @schedule
end

Class Method Details

.find(name) ⇒ Object



111
112
113
114
115
# File 'lib/whimsy/asf/committee.rb', line 111

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

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



311
312
313
# File 'lib/whimsy/asf/ldap.rb', line 311

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

.load_committee_infoObject



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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/whimsy/asf/committee.rb', line 47

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

  info = File.read(file).split(/^\* /)
  head, report = info.shift.split(/^\d\./)[1..2]
  head.gsub! /^\s+NAME\s+CHAIR\s*$/,'' # otherwise could match an entry with no e-mail

  # extract the committee chairs (e-mail address is required here)
  head.scan(/^[ \t]+(\w.*?)[ \t][ \t]+(.*)[ \t]+<(.*?)@apache\.org>/).
    each do |committee, name, 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| list[name]}

  info.each do |roster|
    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
      ''
    end
    committee.info = roster.scan(/<(.*?)@apache\.org>/).flatten
    committee.roster = Hash[roster.gsub(/\(\w+\)/, '').
      scan(/^\s*(.*?)\s*<(.*?)@apache\.org>\s+(\[(.*?)\])?/).
      map {|list| [list[1], {name: list[0], date: list[3]}]}]
  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 = list[committee]
      if comment
        committee.report = "#{period}: #{comment}"
      elsif period == 'Next month'
        committee.report = 'Every month'
      else
        committee.schedule = period
      end
    end
  end

  @committee_info = list.values
end

.nonpmcsObject



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

def self.nonpmcs
  @nonpmcs
end

.svn_changeObject



117
118
119
# File 'lib/whimsy/asf/committee.rb', line 117

def self.svn_change
  @@svn_change
end

Instance Method Details

#chairObject



121
122
123
124
125
126
127
128
# File 'lib/whimsy/asf/committee.rb', line 121

def chair
  Committee.load_committee_info
  if @chairs.length >= 1
    ASF::Person.find(@chairs.first[:id])
  else
    nil
  end
end

#descriptionObject



96
97
98
99
# File 'lib/whimsy/asf/site.rb', line 96

def description
  site = ASF::Site.find(name)
  site[:text] if site
end

#display_nameObject



130
131
132
133
# File 'lib/whimsy/asf/committee.rb', line 130

def display_name
  Committee.load_committee_info
  @display_name || name
end

#display_name=(name) ⇒ Object



135
136
137
# File 'lib/whimsy/asf/committee.rb', line 135

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

#dnObject



320
321
322
# File 'lib/whimsy/asf/ldap.rb', line 320

def dn
  @dn ||= ASF.search_one(base, "cn=#{name}", 'dn').first.first
end

#mail_listObject



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/whimsy/asf/mail.rb', line 77

def mail_list
  case name.downcase
  when 'comdev'
    'community'
  when 'httpcomponents'
    'hc'
  when 'whimsy'
    'whimsical'

  when 'brand management'
    '[email protected]'
  when 'executive assistant'
    '[email protected]'
  when 'legal affairs'
    '[email protected]'
  when 'marketing and publicity'
    '[email protected]'
  when 'tac'
    '[email protected]'
  when 'w3c relations'
    '[email protected]'
  else
    name
  end
end

#membersObject



315
316
317
318
# File 'lib/whimsy/asf/ldap.rb', line 315

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

#namesObject



147
148
149
150
# File 'lib/whimsy/asf/committee.rb', line 147

def names
  Committee.load_committee_info
  Hash[@roster.map {|id, info| [id, info[:name]]}]
end

#nonpmc?Boolean

Returns:



152
153
154
# File 'lib/whimsy/asf/committee.rb', line 152

def nonpmc?
  Committee.nonpmcs.include? self
end

#siteObject



91
92
93
94
# File 'lib/whimsy/asf/site.rb', line 91

def site
  site = ASF::Site.find(name)
  site[:link] if site
end