2008-05-07 18:22:04 +00:00
|
|
|
#!/usr/bin/ruby
|
2017-02-01 15:35:35 -08:00
|
|
|
# vim: set nosta noet ts=4 sw=4:
|
2008-05-07 18:22:04 +00:00
|
|
|
#
|
2017-02-06 11:54:16 -08:00
|
|
|
# A Ruby interface to the ezmlm-idx mailing list system.
|
2008-05-07 18:22:04 +00:00
|
|
|
#
|
|
|
|
|
# == Version
|
|
|
|
|
#
|
|
|
|
|
# $Id$
|
|
|
|
|
#
|
|
|
|
|
#---
|
|
|
|
|
#
|
|
|
|
|
# Please see the file LICENSE in the base directory for licensing details.
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
require 'pathname'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Toplevel namespace module
|
|
|
|
|
module Ezmlm
|
|
|
|
|
|
|
|
|
|
# Package version
|
2017-02-01 15:35:35 -08:00
|
|
|
VERSION = '0.1.0'
|
2008-05-07 18:22:04 +00:00
|
|
|
|
|
|
|
|
require 'ezmlm/list'
|
|
|
|
|
|
|
|
|
|
###############
|
|
|
|
|
module_function
|
|
|
|
|
###############
|
|
|
|
|
|
2017-02-06 11:54:16 -08:00
|
|
|
### Find all directories that look like an Ezmlm list directory under
|
|
|
|
|
### the specified +listsdir+ and return Pathname objects for each.
|
2017-02-01 15:35:35 -08:00
|
|
|
###
|
2008-08-06 17:24:00 +00:00
|
|
|
def find_directories( listsdir )
|
|
|
|
|
listsdir = Pathname.new( listsdir )
|
2017-02-06 11:54:16 -08:00
|
|
|
return Pathname.glob( listsdir + '*' ).sort.select do |entry|
|
2008-08-06 17:24:00 +00:00
|
|
|
entry.directory? && ( entry + 'mailinglist' ).exist?
|
|
|
|
|
end
|
|
|
|
|
end
|
2017-02-01 15:35:35 -08:00
|
|
|
|
2008-05-07 18:22:04 +00:00
|
|
|
|
2017-02-06 11:54:16 -08:00
|
|
|
### Iterate over each directory that looks like an Ezmlm list in the
|
|
|
|
|
### specified +listsdir+ and yield it as an Ezmlm::List object.
|
2017-02-01 15:35:35 -08:00
|
|
|
###
|
2008-05-07 18:22:04 +00:00
|
|
|
def each_list( listsdir )
|
2008-08-06 17:24:00 +00:00
|
|
|
find_directories( listsdir ).each do |entry|
|
2008-05-07 18:22:04 +00:00
|
|
|
yield( Ezmlm::List.new(entry) )
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end # module Ezmlm
|
|
|
|
|
|