author | Mahlon E. Smith <mahlon@laika.com> |
Tue, 16 May 2017 15:57:53 -0700 | |
changeset 21 | 1ebc33d48c85 |
parent 20 | 9d59d30685cb |
child 22 | d1b9dd767e3a |
permissions | -rw-r--r-- |
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
1 |
# vim: set nosta noet ts=4 sw=4: |
17 | 2 |
|
20
9d59d30685cb
Fixes for documentation and test directories that didn't make it into the repo.
Mahlon E. Smith <mahlon@laika.com>
parents:
18
diff
changeset
|
3 |
require 'pathname' |
17 | 4 |
|
5 |
# A Ruby interface to the ezmlm-idx mailing list system. |
|
1
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
6 |
# |
17 | 7 |
# Ezmlm.find_directories( '/lists' ) #=> [ Ezmlm::List, Ezmlm::List ] |
8 |
# |
|
9 |
# Ezmlm.each_list( '/lists' ) do |list| |
|
10 |
# puts "\"%s\" <%s>" % [ list.name, list.address ] |
|
11 |
# end |
|
12 |
# |
|
1
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
13 |
module Ezmlm |
20
9d59d30685cb
Fixes for documentation and test directories that didn't make it into the repo.
Mahlon E. Smith <mahlon@laika.com>
parents:
18
diff
changeset
|
14 |
# $Id$ |
1
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
15 |
|
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
16 |
# Package version |
20
9d59d30685cb
Fixes for documentation and test directories that didn't make it into the repo.
Mahlon E. Smith <mahlon@laika.com>
parents:
18
diff
changeset
|
17 |
VERSION = '1.0.1' |
1
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
18 |
|
15 | 19 |
# Suck in the components. |
20 |
# |
|
16
e135ccae6783
Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents:
15
diff
changeset
|
21 |
require 'ezmlm/hash' |
1
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
22 |
require 'ezmlm/list' |
15 | 23 |
require 'ezmlm/list/author' |
24 |
require 'ezmlm/list/message' |
|
25 |
require 'ezmlm/list/thread' |
|
26 |
||
1
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
27 |
|
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
28 |
############### |
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
29 |
module_function |
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
30 |
############### |
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
31 |
|
14 | 32 |
### Find all directories that look like an Ezmlm list directory under |
33 |
### the specified +listsdir+ and return Pathname objects for each. |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
34 |
### |
6 | 35 |
def find_directories( listsdir ) |
36 |
listsdir = Pathname.new( listsdir ) |
|
14 | 37 |
return Pathname.glob( listsdir + '*' ).sort.select do |entry| |
6 | 38 |
entry.directory? && ( entry + 'mailinglist' ).exist? |
39 |
end |
|
40 |
end |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
41 |
|
1
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
42 |
|
14 | 43 |
### Iterate over each directory that looks like an Ezmlm list in the |
44 |
### specified +listsdir+ and yield it as an Ezmlm::List object. |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
45 |
### |
1
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
46 |
def each_list( listsdir ) |
6 | 47 |
find_directories( listsdir ).each do |entry| |
1
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
48 |
yield( Ezmlm::List.new(entry) ) |
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
49 |
end |
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
50 |
end |
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
51 |
|
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
52 |
end # module Ezmlm |
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
53 |