equal
deleted
inserted
replaced
1 #!/usr/bin/ruby |
1 #!/usr/bin/ruby |
2 # vim: set nosta noet ts=4 sw=4: |
2 # vim: set nosta noet ts=4 sw=4: |
3 # |
3 # |
4 # A Ruby programmatic interface to the ezmlm-idx mailing list system |
4 # A Ruby interface to the ezmlm-idx mailing list system. |
5 # |
5 # |
6 # == Version |
6 # == Version |
7 # |
7 # |
8 # $Id$ |
8 # $Id$ |
9 # |
9 # |
25 |
25 |
26 ############### |
26 ############### |
27 module_function |
27 module_function |
28 ############### |
28 ############### |
29 |
29 |
30 ### Find all directories that look like an Ezmlm list directory under the specified +listsdir+ |
30 ### Find all directories that look like an Ezmlm list directory under |
31 ### and return Pathname objects for each. |
31 ### the specified +listsdir+ and return Pathname objects for each. |
32 ### |
32 ### |
33 def find_directories( listsdir ) |
33 def find_directories( listsdir ) |
34 listsdir = Pathname.new( listsdir ) |
34 listsdir = Pathname.new( listsdir ) |
35 return Pathname.glob( listsdir + '*' ).select do |entry| |
35 return Pathname.glob( listsdir + '*' ).sort.select do |entry| |
36 entry.directory? && ( entry + 'mailinglist' ).exist? |
36 entry.directory? && ( entry + 'mailinglist' ).exist? |
37 end |
37 end |
38 end |
38 end |
39 |
39 |
40 |
40 |
41 ### Iterate over each directory that looks like an Ezmlm list in the specified +listsdir+ and |
41 ### Iterate over each directory that looks like an Ezmlm list in the |
42 ### yield it as an Ezmlm::List object. |
42 ### specified +listsdir+ and yield it as an Ezmlm::List object. |
43 ### |
43 ### |
44 def each_list( listsdir ) |
44 def each_list( listsdir ) |
45 find_directories( listsdir ).each do |entry| |
45 find_directories( listsdir ).each do |entry| |
46 yield( Ezmlm::List.new(entry) ) |
46 yield( Ezmlm::List.new(entry) ) |
47 end |
47 end |