You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2021/02/27 01:30:03 UTC

[whimsy] branch master updated: Binary conversion via options does not work ...

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new afef695  Binary conversion via options does not work ...
afef695 is described below

commit afef6953d56eeb1883ca9d56c973d0855bb76af3
Author: Sebb <se...@apache.org>
AuthorDate: Sat Feb 27 01:29:54 2021 +0000

    Binary conversion via options does not work ...
---
 lib/whimsy/asf/member-files.rb | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/lib/whimsy/asf/member-files.rb b/lib/whimsy/asf/member-files.rb
index c0b7482..93b5ed7 100644
--- a/lib/whimsy/asf/member-files.rb
+++ b/lib/whimsy/asf/member-files.rb
@@ -28,13 +28,7 @@ module ASF
       # Find most recent file:
       nomfile = Dir[File.join(ASF::SVN['Meetings'], '*', name)].max
 
-      # options = {:external_encoding => Encoding::BINARY}
-      options = {:external_encoding => Encoding::BINARY,
-                 :internal_encoding => Encoding::UTF_8,
-                 :invalid => :replace}
-      # N.B. the ** prefix is needed to avoid the following message:
-      # Warning: Using the last argument as keyword parameters is deprecated 
-      File.open(nomfile, mode='r', **options)
+      File.open(nomfile, mode='rb')
         .slice_before(/^\s*---+--\s*/)
         .drop(2) # instructions and sample block
         .each do |block|
@@ -87,8 +81,17 @@ module ASF
       ASF::MemberFiles.parse_file('board_nominations.txt') do |hdr, nominee|
         # for board, the header currentl looks like this:
         # <PUBLIC NAME>
-        id = ASF::Person.listids("cn=#{hdr}").first      
-        nominee['Public Name'] = hdr # the board file does not have ids, unfortunately
+        id = ASF::Person.listids("cn=#{hdr}").first
+        # Allow for missing initials; check first and last name
+        unless id
+          gn, sn, rest = hdr.split(' ')
+          if rest # more than two words
+            id = hdr
+          else
+            id = ASF::Person.listids("(&(sn=#{sn})(givenName=#{gn}))").first || hdr
+          end
+        end
+        nominee['Public Name'] = hdr.force_encoding(Encoding::UTF_8) # the board file does not have ids, unfortunately
         nominees[id] = nominee
       end
       nominees