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 b5456158 Initial parse of marker files
b5456158 is described below

commit b5456158e779557697d2d33e0b9496ee9ba023c6
Author: Sebb <s...@apache.org>
AuthorDate: Wed Apr 10 17:09:47 2024 +0100

    Initial parse of marker files
---
 lib/whimsy/asf/mlist.rb | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/lib/whimsy/asf/mlist.rb b/lib/whimsy/asf/mlist.rb
index 064eac3a..91ef0cb1 100644
--- a/lib/whimsy/asf/mlist.rb
+++ b/lib/whimsy/asf/mlist.rb
@@ -277,6 +277,24 @@ module ASF
       end
     end
 
+    # Parse the marker files: modpost, modsub, remote
+    # Return hash: key="domain list", value=hash containing :modsub, :modpost, 
:remote
+    # if the list has the corresponding file
+    # BETA: API may change!
+    def self.parse_markers
+      hash = Hash.new {|h,k| h[k] = Hash.new}
+      File.open(File.join(LIST_BASE, 'list-modsub')).each do |line|
+        hash[line.chomp][:modsub] = 1
+      end
+      File.open(File.join(LIST_BASE, 'list-modpost')).each do |line|
+        hash[line.chomp][:modpost] = 1
+      end
+      File.open(File.join(LIST_BASE, 'list-remote')).each do |line|
+        hash[line.chomp][:remote] = 1
+      end
+      hash
+    end
+
     private
 
     # return the archiver type as array: 
[:MBOX|:PONY|:MINO|:MAIL_ARCH|:MARKMAIL|:WHIMSY, 
'public'|'private'|'alias'|'direct']
@@ -444,6 +462,8 @@ end
 if __FILE__ == $0
   $LOAD_PATH.unshift '/srv/whimsy/lib'
   require 'whimsy/asf'
+  p ASF::MLIST.parse_markers
+  exit
   domain = ARGV.shift || 'whimsical'
   mlist = ASF::Committee.find(domain).mail_list
   p mlist

Reply via email to