whimsy-asf 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 84a3a8aca38d54c7c2e4a7751ec66348a8be9685
4
- data.tar.gz: c3915eee7c05d20aea3ec2cb2df148754a58e519
3
+ metadata.gz: 6eb852ac4f2c64a970934863aa87e7291b6a82e1
4
+ data.tar.gz: 6578c7334388ad0120658dc0355a279c92952acd
5
5
  SHA512:
6
- metadata.gz: 8b894db5348014b45c2bd6b4f920991a312522e0de23459fb644ae49af4b0c9daf2b4e7acea2df8638fc4dbc8a1869eb4881b17782adcd2e0b93bfc64ba6a9e1
7
- data.tar.gz: 6e11d6c03803b548ea66fb7d1cfef9b0c1460e396684aacd6b51d39dee7bd732a94071906d519b08e18964aea037398944960a68f3441e9db2b722262d8b7983
6
+ metadata.gz: c23650c64a464a1cd6d6d7ec6d516b5e3916f0563553252175b505979b62fb8b790f1ce9dda19541aba0e8a5f5bb27b0fb18834ff7c3f6b91072d58f89675d51
7
+ data.tar.gz: b00fef3cfaff262e35ec38e8916a35d6c94c4c8648a9f0bc75607568721b3b00d4faad53fc052b18303e604d36e5f0374a3ee9144c0cc8a2e810d3eca005ef7f
@@ -1 +1 @@
1
- 0.0.9
1
+ 0.0.10
@@ -23,9 +23,9 @@ class ASF::Board::Agenda
23
23
  }
24
24
 
25
25
  @@parsers = []
26
- def self.parse(file=nil, &block)
26
+ def self.parse(file=nil, quick=false, &block)
27
27
  @@parsers << block if block
28
- new.parse(file) if file
28
+ new.parse(file, quick) if file
29
29
  end
30
30
 
31
31
  def initialize
@@ -50,8 +50,9 @@ class ASF::Board::Agenda
50
50
  end
51
51
  end
52
52
 
53
- def parse(file)
53
+ def parse(file, quick=false)
54
54
  @file = file
55
+ @quick = quick
55
56
 
56
57
  if not @file.valid_encoding?
57
58
  filter = Proc.new {|c| c.unpack('U').first rescue 0xFFFD}
@@ -84,16 +85,18 @@ class ASF::Board::Agenda
84
85
  end
85
86
  end
86
87
 
87
- # add roster and prior report link
88
- whimsy = 'https://whimsy.apache.org'
89
- @sections.each do |section, hash|
90
- next unless section =~ /^(4[A-Z]|\d+|[A-Z][A-Z]?)$/
91
- committee = ASF::Committee.find(hash['title'] ||= 'UNKNOWN')
92
- unless section =~ /^4[A-Z]$/
93
- hash['roster'] =
94
- "#{whimsy}/roster/committee/#{CGI.escape committee.name}"
88
+ unless @quick
89
+ # add roster and prior report link
90
+ whimsy = 'https://whimsy.apache.org'
91
+ @sections.each do |section, hash|
92
+ next unless section =~ /^(4[A-Z]|\d+|[A-Z][A-Z]?)$/
93
+ committee = ASF::Committee.find(hash['title'] ||= 'UNKNOWN')
94
+ unless section =~ /^4[A-Z]$/
95
+ hash['roster'] =
96
+ "#{whimsy}/roster/committee/#{CGI.escape committee.name}"
97
+ end
98
+ hash['prior_reports'] = minutes(committee.display_name)
95
99
  end
96
- hash['prior_reports'] = minutes(committee.display_name)
97
100
  end
98
101
 
99
102
  # add attach to section
@@ -32,12 +32,14 @@ class ASF::Board::Agenda
32
32
 
33
33
  attrs['missing'] = true if attrs['report'].strip.empty?
34
34
 
35
- begin
36
- committee = ASF::Committee.find(attrs['title'])
37
- attrs['chair_email'] = committee.chair.mail.first
38
- attrs['mail_list'] = committee.mail_list
39
- attrs.delete('mail_list') if attrs['mail_list'].include? ' '
40
- rescue
35
+ unless @quick
36
+ begin
37
+ committee = ASF::Committee.find(attrs['title'])
38
+ attrs['chair_email'] = committee.chair.mail.first
39
+ attrs['mail_list'] = committee.mail_list
40
+ attrs.delete('mail_list') if attrs['mail_list'].include? ' '
41
+ rescue
42
+ end
41
43
  end
42
44
 
43
45
  if attrs['report'].to_s.include? "\uFFFD"
@@ -20,52 +20,54 @@ class ASF::Board::Agenda
20
20
 
21
21
  absent = attr['text'].scan(/Absent:\n\n.*?\n\n/m).join
22
22
 
23
- # attempt to identify the people mentioned in the Roll Call
24
- people = attr['text'].scan(/ {8}(\w.*)/).flatten.each do |sname|
25
- name = sname
23
+ unless @quick
24
+ # attempt to identify the people mentioned in the Roll Call
25
+ people = attr['text'].scan(/ {8}(\w.*)/).flatten.each do |sname|
26
+ name = sname
26
27
 
27
- # first try the cache
28
- person = @@people_cache[name]
28
+ # first try the cache
29
+ person = @@people_cache[name]
29
30
 
30
- # next try a simple name look up
31
- if not person
32
- search = ASF::Person.list("cn=#{name}")
33
- person = search.first if search.length == 1
34
- end
31
+ # next try a simple name look up
32
+ if not person
33
+ search = ASF::Person.list("cn=#{name}")
34
+ person = search.first if search.length == 1
35
+ end
35
36
 
36
- # finally try harder to match the name
37
- if not person
38
- sname = sname.strip.downcase.split(/\s+/)
37
+ # finally try harder to match the name
38
+ if not person
39
+ sname = sname.strip.downcase.split(/\s+/)
39
40
 
40
- if not list
41
- ASF::Person.preload('cn')
42
- list = ASF::Person.list
43
- end
41
+ if not list
42
+ ASF::Person.preload('cn')
43
+ list = ASF::Person.list
44
+ end
44
45
 
45
- search = []
46
- list.select do |person|
47
- next if person == 'none'
48
- pname = person.public_name.downcase.split(/\s+/)
49
- if sname.all? {|t1| pname.any? {|t2| t2.start_with? t1}}
50
- search << person
51
- elsif pname.all? {|t1| sname.any? {|t2| t2.start_with? t1}}
52
- search << person
53
- end
54
- end
46
+ search = []
47
+ list.select do |person|
48
+ next if person == 'none'
49
+ pname = person.public_name.downcase.split(/\s+/)
50
+ if sname.all? {|t1| pname.any? {|t2| t2.start_with? t1}}
51
+ search << person
52
+ elsif pname.all? {|t1| sname.any? {|t2| t2.start_with? t1}}
53
+ search << person
54
+ end
55
+ end
55
56
 
56
- person = search.first if search.length == 1
57
- end
57
+ person = search.first if search.length == 1
58
+ end
58
59
 
59
- # save results in both the cache and the attributes
60
- if person
61
- @@people_cache[name] = person
60
+ # save results in both the cache and the attributes
61
+ if person
62
+ @@people_cache[name] = person
62
63
 
63
- attr['people'][person.id] = {
64
- name: name,
65
- member: person.asf_member?,
66
- attending: !absent.include?(name)
67
- }
68
- end
64
+ attr['people'][person.id] = {
65
+ name: name,
66
+ member: person.asf_member?,
67
+ attending: !absent.include?(name)
68
+ }
69
+ end
70
+ end
69
71
  end
70
72
  elsif attr['title'] == 'Call to order'
71
73
  attr['timestamp'] = timestamp(attr['text'][/\d+:\d+([ap]m)?/])
@@ -43,6 +43,8 @@ class ASF::Board::Agenda
43
43
  attrs.delete 'indent'
44
44
  attrs.delete 'warnings' if attrs['warnings'].empty?
45
45
 
46
+ next if @quick
47
+
46
48
  asfid = '[a-z][-.a-z0-9_]+' # dot added to help detect errors
47
49
  list_item = '^\s*(?:[-*\u2022]\s*)?(.*?)\s+'
48
50
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whimsy-asf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Ruby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-19 00:00:00.000000000 Z
11
+ date: 2015-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri