Skip to content

Commit

Permalink
Initial parse of marker files
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbASF committed Apr 10, 2024
1 parent d798186 commit b545615
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/whimsy/asf/mlist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,24 @@ def self.each_list
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']
Expand Down Expand Up @@ -444,6 +462,8 @@ def self.list_parse(type, &block)
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
Expand Down

0 comments on commit b545615

Please sign in to comment.