[whimsy] branch master updated: Simplify; add doc note

2021-07-26 Thread sebb
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 cf561d9  Simplify; add doc note
cf561d9 is described below

commit cf561d92e7b3943b17e9d78bd4c5f5482628360d
Author: Sebb 
AuthorDate: Mon Jul 26 23:44:57 2021 +0100

Simplify; add doc note
---
 lib/whimsy/asf/person.rb | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/whimsy/asf/person.rb b/lib/whimsy/asf/person.rb
index 49508cd..871b735 100644
--- a/lib/whimsy/asf/person.rb
+++ b/lib/whimsy/asf/person.rb
@@ -167,18 +167,21 @@ module ASF
 
 # extract sn and givenName from cn (needed for LDAP entries)
 # returns sn, [givenName,...]
+# Note that givenName is returned as an array (may be empty). 
+# This is because givenName is an optional attribute which may appear 
multiple times.
+# It remains to be seen whether we want to create multiple attributes, 
+# or whether it is more appropriate to add at most one attribute
+# containing all the givenName values. [The array can be joined to produce 
a single value].
 # DRAFT version: not for general use yet
 # Does not handle multi-word family names or honorifics etc
 def self.ldap_parse_cn_DRAFT(cn, familyFirst)
   words = cn.split(' ')
   if familyFirst
 sn = words.shift
-givenName = words
   else
 sn = words.pop
-givenName = words
   end
-  return sn, givenName
+  return sn, words
 end
 
 # Name equivalences


[whimsy] branch master updated: Add draft method to convert cn to sn + givenName

2021-07-26 Thread sebb
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 468b9b9  Add draft method to convert cn to sn + givenName
468b9b9 is described below

commit 468b9b9faab3f33b34633a00b369cd1705212762
Author: Sebb 
AuthorDate: Mon Jul 26 23:26:05 2021 +0100

Add draft method to convert cn to sn + givenName
---
 lib/spec/lib/person_spec.rb | 38 ++
 lib/whimsy/asf/person.rb| 16 
 2 files changed, 54 insertions(+)

diff --git a/lib/spec/lib/person_spec.rb b/lib/spec/lib/person_spec.rb
new file mode 100644
index 000..c662c54
--- /dev/null
+++ b/lib/spec/lib/person_spec.rb
@@ -0,0 +1,38 @@
+require 'spec_helper'
+require 'whimsy/asf'
+
+describe ASF::Person do
+  it  "ldap_parse_cn_DRAFT('', false) should return [nil, []]" do
+res = ASF::Person.ldap_parse_cn_DRAFT('', false)
+expect(res).to eq([nil, []])
+  end
+  it  "ldap_parse_cn_DRAFT('', true) should return [nil, []]" do
+res = ASF::Person.ldap_parse_cn_DRAFT('', true)
+expect(res).to eq([nil, []])
+  end
+  # If there is only one name, it must be the surname
+  it  "ldap_parse_cn_DRAFT('one', false) should return ['one', []]" do
+res = ASF::Person.ldap_parse_cn_DRAFT('one', false)
+expect(res).to eq(['one', []])
+  end
+  it  "ldap_parse_cn_DRAFT('one', true) should return ['one', []]" do
+res = ASF::Person.ldap_parse_cn_DRAFT('one', true)
+expect(res).to eq(['one', []])
+  end
+  it  "ldap_parse_cn_DRAFT('one two', false) should return ['two', ['one']]" do
+res = ASF::Person.ldap_parse_cn_DRAFT('one two', false)
+expect(res).to eq(['two', ['one']])
+  end
+  it  "ldap_parse_cn_DRAFT('one two', true) should return ['one', ['two']]" do
+res = ASF::Person.ldap_parse_cn_DRAFT('one two', true)
+expect(res).to eq(['one', ['two']])
+  end
+  it  "ldap_parse_cn_DRAFT('one two three', false) should return ['three', 
['one', 'two']]" do
+res = ASF::Person.ldap_parse_cn_DRAFT('one two three', false)
+expect(res).to eq(['three', ['one', 'two']])
+  end
+  it  "ldap_parse_cn_DRAFT('one two three', tru) should return ['one', ['two', 
'three']]" do
+res = ASF::Person.ldap_parse_cn_DRAFT('one two three', true)
+expect(res).to eq(['one', ['two', 'three']])
+  end
+end
\ No newline at end of file
diff --git a/lib/whimsy/asf/person.rb b/lib/whimsy/asf/person.rb
index 8ba6fc4..49508cd 100644
--- a/lib/whimsy/asf/person.rb
+++ b/lib/whimsy/asf/person.rb
@@ -165,6 +165,22 @@ module ASF
   result
 end
 
+# extract sn and givenName from cn (needed for LDAP entries)
+# returns sn, [givenName,...]
+# DRAFT version: not for general use yet
+# Does not handle multi-word family names or honorifics etc
+def self.ldap_parse_cn_DRAFT(cn, familyFirst)
+  words = cn.split(' ')
+  if familyFirst
+sn = words.shift
+givenName = words
+  else
+sn = words.pop
+givenName = words
+  end
+  return sn, givenName
+end
+
 # Name equivalences
 names = [
   %w(Alex Alexander Alexandru), 


[whimsy] branch master updated: Non-standard list name

2021-07-26 Thread sebb
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 734f545  Non-standard list name
734f545 is described below

commit 734f5451cbc210f1be5e0dce0b53d1aeaa0a4b91
Author: Sebb 
AuthorDate: Mon Jul 26 17:20:13 2021 +0100

Non-standard list name
---
 lib/spec/lib/mail/mlist_spec.rb | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/spec/lib/mail/mlist_spec.rb b/lib/spec/lib/mail/mlist_spec.rb
index dd04556..e27a845 100644
--- a/lib/spec/lib/mail/mlist_spec.rb
+++ b/lib/spec/lib/mail/mlist_spec.rb
@@ -79,6 +79,7 @@ describe ASF::MLIST do
 expect(dom.class).to eq(String)
 expect(list.class).to eq(String)
 expect(dom).to match(/^[a-z.0-9-]+\.[a-z]+$/)
+next if list == 'commits.deprecated' # allow for unusual list name
 expect(list).to match(/^[a-z0-9-]+$/)
   end
 end